Completed
Branch EDTR/input-labels (73d1b5)
by
unknown
11:26 queued 01:08
created
strategies/validation/EE_Full_HTML_Validation_Strategy.strategy.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -14,62 +14,62 @@
 block discarded – undo
14 14
 class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base
15 15
 {
16 16
 
17
-    /**
18
-     * @param null $validation_error_message
19
-     */
20
-    public function __construct($validation_error_message = null)
21
-    {
22
-        if (! $validation_error_message) {
23
-            $validation_error_message = sprintf(
24
-                __('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"),
25
-                '<br />',
26
-                $this->get_list_of_allowed_tags()
27
-            );
28
-        }
29
-        parent::__construct($validation_error_message);
30
-    }
17
+	/**
18
+	 * @param null $validation_error_message
19
+	 */
20
+	public function __construct($validation_error_message = null)
21
+	{
22
+		if (! $validation_error_message) {
23
+			$validation_error_message = sprintf(
24
+				__('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"),
25
+				'<br />',
26
+				$this->get_list_of_allowed_tags()
27
+			);
28
+		}
29
+		parent::__construct($validation_error_message);
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * get_list_of_allowed_tags
35
-     *
36
-     * generates and returns a string that lists the top-level HTML tags that are allowable for this input
37
-     *
38
-     * @return string
39
-     */
40
-    public function get_list_of_allowed_tags()
41
-    {
42
-        $tags_we_allow = $this->getAllowedTags();
43
-        ksort($tags_we_allow);
44
-        return implode(', ', array_keys($tags_we_allow));
45
-    }
33
+	/**
34
+	 * get_list_of_allowed_tags
35
+	 *
36
+	 * generates and returns a string that lists the top-level HTML tags that are allowable for this input
37
+	 *
38
+	 * @return string
39
+	 */
40
+	public function get_list_of_allowed_tags()
41
+	{
42
+		$tags_we_allow = $this->getAllowedTags();
43
+		ksort($tags_we_allow);
44
+		return implode(', ', array_keys($tags_we_allow));
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * Returns an array whose keys are allowed tags and values are an array of allowed attributes
50
-     *
51
-     * @return array
52
-     */
53
-    protected function getAllowedTags()
54
-    {
55
-        global $allowedposttags;
56
-        return array_merge_recursive(
57
-            $allowedposttags,
58
-            EEH_HTML::get_simple_tags()
59
-        );
60
-    }
48
+	/**
49
+	 * Returns an array whose keys are allowed tags and values are an array of allowed attributes
50
+	 *
51
+	 * @return array
52
+	 */
53
+	protected function getAllowedTags()
54
+	{
55
+		global $allowedposttags;
56
+		return array_merge_recursive(
57
+			$allowedposttags,
58
+			EEH_HTML::get_simple_tags()
59
+		);
60
+	}
61 61
 
62 62
 
63
-    /**
64
-     * @param $normalized_value
65
-     * @throws \EE_Validation_Error
66
-     */
67
-    public function validate($normalized_value)
68
-    {
69
-        parent::validate($normalized_value);
70
-        $normalized_value_sans_tags = wp_kses("$normalized_value", $this->getAllowedTags());
71
-        if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
72
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
73
-        }
74
-    }
63
+	/**
64
+	 * @param $normalized_value
65
+	 * @throws \EE_Validation_Error
66
+	 */
67
+	public function validate($normalized_value)
68
+	{
69
+		parent::validate($normalized_value);
70
+		$normalized_value_sans_tags = wp_kses("$normalized_value", $this->getAllowedTags());
71
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
72
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
73
+		}
74
+	}
75 75
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public function __construct($validation_error_message = null)
21 21
     {
22
-        if (! $validation_error_message) {
22
+        if ( ! $validation_error_message) {
23 23
             $validation_error_message = sprintf(
24 24
                 __('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"),
25 25
                 '<br />',
Please login to merge, or discard this patch.
core/services/assets/AssetCollection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             /** @var Asset $asset */
76 76
             $asset = $this->current();
77 77
             if ($asset->type() === $type) {
78
-                $files[ $asset->handle() ] = $asset;
78
+                $files[$asset->handle()] = $asset;
79 79
             }
80 80
             $this->next();
81 81
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             /** @var JavascriptAsset $asset */
97 97
             $asset = $this->current();
98 98
             if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) {
99
-                $files[ $asset->handle() ] = $asset;
99
+                $files[$asset->handle()] = $asset;
100 100
             }
101 101
             $this->next();
102 102
         }
Please login to merge, or discard this patch.
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -21,192 +21,192 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 
24
-    /**
25
-     * AssetCollection constructor
26
-     *
27
-     * @throws InvalidInterfaceException
28
-     */
29
-    public function __construct()
30
-    {
31
-        parent::__construct('EventEspresso\core\domain\values\assets\Asset');
32
-    }
33
-
34
-
35
-    /**
36
-     * @return StylesheetAsset[]
37
-     * @since 4.9.62.p
38
-     */
39
-    public function getStylesheetAssets()
40
-    {
41
-        return $this->getAssetsOfType(Asset::TYPE_CSS);
42
-    }
43
-
44
-
45
-    /**
46
-     * @return JavascriptAsset[]
47
-     * @since 4.9.62.p
48
-     */
49
-    public function getJavascriptAssets()
50
-    {
51
-        return $this->getAssetsOfType(Asset::TYPE_JS);
52
-    }
53
-
54
-
55
-    /**
56
-     * @return ManifestFile[]
57
-     * @since 4.9.62.p
58
-     */
59
-    public function getManifestFiles()
60
-    {
61
-        return $this->getAssetsOfType(Asset::TYPE_MANIFEST);
62
-    }
63
-
64
-
65
-    /**
66
-     * @param $type
67
-     * @return JavascriptAsset[]|StylesheetAsset[]|ManifestFile[]
68
-     * @since 4.9.62.p
69
-     */
70
-    protected function getAssetsOfType($type)
71
-    {
72
-        $files = array();
73
-        $this->rewind();
74
-        while ($this->valid()) {
75
-            /** @var Asset $asset */
76
-            $asset = $this->current();
77
-            if ($asset->type() === $type) {
78
-                $files[ $asset->handle() ] = $asset;
79
-            }
80
-            $this->next();
81
-        }
82
-        $this->rewind();
83
-        return $files;
84
-    }
85
-
86
-
87
-    /**
88
-     * @return JavascriptAsset[]
89
-     * @since 4.9.62.p
90
-     */
91
-    public function getJavascriptAssetsWithData()
92
-    {
93
-        $files = array();
94
-        $this->rewind();
95
-        while ($this->valid()) {
96
-            /** @var JavascriptAsset $asset */
97
-            $asset = $this->current();
98
-            if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) {
99
-                $files[ $asset->handle() ] = $asset;
100
-            }
101
-            $this->next();
102
-        }
103
-        $this->rewind();
104
-        return $files;
105
-    }
106
-
107
-
108
-    /**
109
-     * returns TRUE or FALSE
110
-     * depending on whether the object is within the Collection
111
-     * based on the supplied $identifier and type
112
-     *
113
-     * @param  mixed $identifier
114
-     * @param string $type
115
-     * @return bool
116
-     * @since 4.9.63.p
117
-     */
118
-    public function hasAssetOfType($identifier, $type = Asset::TYPE_JS)
119
-    {
120
-        $this->rewind();
121
-        while ($this->valid()) {
122
-            if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
123
-                $this->rewind();
124
-                return true;
125
-            }
126
-            $this->next();
127
-        }
128
-        return false;
129
-    }
130
-
131
-
132
-    /**
133
-     * returns TRUE or FALSE
134
-     * depending on whether the Javascript Asset is within the Collection
135
-     * based on the supplied $identifier
136
-     *
137
-     * @param  mixed $identifier
138
-     * @return bool
139
-     * @since 4.9.63.p
140
-     */
141
-    public function hasJavascriptAsset($identifier)
142
-    {
143
-        return $this->hasAssetOfType($identifier, Asset::TYPE_JS);
144
-    }
145
-
146
-
147
-    /**
148
-     * returns TRUE or FALSE
149
-     * depending on whether the Stylesheet Asset is within the Collection
150
-     * based on the supplied $identifier
151
-     *
152
-     * @param  mixed $identifier
153
-     * @return bool
154
-     * @since 4.9.63.p
155
-     */
156
-    public function hasStylesheetAsset($identifier)
157
-    {
158
-        return $this->hasAssetOfType($identifier, Asset::TYPE_CSS);
159
-    }
160
-
161
-    /**
162
-     * returns the object from the Collection
163
-     * based on the supplied $identifier and type
164
-     *
165
-     * @param  mixed $identifier
166
-     * @param string $type
167
-     * @return JavascriptAsset|StylesheetAsset
168
-     * @since 4.9.63.p
169
-     */
170
-    public function getAssetOfType($identifier, $type = Asset::TYPE_JS)
171
-    {
172
-        $this->rewind();
173
-        while ($this->valid()) {
174
-            if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
175
-                /** @var JavascriptAsset|StylesheetAsset $object */
176
-                $object = $this->current();
177
-                $this->rewind();
178
-                return $object;
179
-            }
180
-            $this->next();
181
-        }
182
-        return null;
183
-    }
184
-
185
-
186
-    /**
187
-     * returns the Stylesheet Asset from the Collection
188
-     * based on the supplied $identifier
189
-     *
190
-     * @param  mixed $identifier
191
-     * @return StylesheetAsset
192
-     * @since 4.9.63.p
193
-     */
194
-    public function getStylesheetAsset($identifier)
195
-    {
196
-        return $this->getAssetOfType($identifier, Asset::TYPE_CSS);
197
-    }
198
-
199
-
200
-    /**
201
-     * returns the Javascript Asset from the Collection
202
-     * based on the supplied $identifier
203
-     *
204
-     * @param  mixed $identifier
205
-     * @return JavascriptAsset
206
-     * @since 4.9.63.p
207
-     */
208
-    public function getJavascriptAsset($identifier)
209
-    {
210
-        return $this->getAssetOfType($identifier, Asset::TYPE_JS);
211
-    }
24
+	/**
25
+	 * AssetCollection constructor
26
+	 *
27
+	 * @throws InvalidInterfaceException
28
+	 */
29
+	public function __construct()
30
+	{
31
+		parent::__construct('EventEspresso\core\domain\values\assets\Asset');
32
+	}
33
+
34
+
35
+	/**
36
+	 * @return StylesheetAsset[]
37
+	 * @since 4.9.62.p
38
+	 */
39
+	public function getStylesheetAssets()
40
+	{
41
+		return $this->getAssetsOfType(Asset::TYPE_CSS);
42
+	}
43
+
44
+
45
+	/**
46
+	 * @return JavascriptAsset[]
47
+	 * @since 4.9.62.p
48
+	 */
49
+	public function getJavascriptAssets()
50
+	{
51
+		return $this->getAssetsOfType(Asset::TYPE_JS);
52
+	}
53
+
54
+
55
+	/**
56
+	 * @return ManifestFile[]
57
+	 * @since 4.9.62.p
58
+	 */
59
+	public function getManifestFiles()
60
+	{
61
+		return $this->getAssetsOfType(Asset::TYPE_MANIFEST);
62
+	}
63
+
64
+
65
+	/**
66
+	 * @param $type
67
+	 * @return JavascriptAsset[]|StylesheetAsset[]|ManifestFile[]
68
+	 * @since 4.9.62.p
69
+	 */
70
+	protected function getAssetsOfType($type)
71
+	{
72
+		$files = array();
73
+		$this->rewind();
74
+		while ($this->valid()) {
75
+			/** @var Asset $asset */
76
+			$asset = $this->current();
77
+			if ($asset->type() === $type) {
78
+				$files[ $asset->handle() ] = $asset;
79
+			}
80
+			$this->next();
81
+		}
82
+		$this->rewind();
83
+		return $files;
84
+	}
85
+
86
+
87
+	/**
88
+	 * @return JavascriptAsset[]
89
+	 * @since 4.9.62.p
90
+	 */
91
+	public function getJavascriptAssetsWithData()
92
+	{
93
+		$files = array();
94
+		$this->rewind();
95
+		while ($this->valid()) {
96
+			/** @var JavascriptAsset $asset */
97
+			$asset = $this->current();
98
+			if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) {
99
+				$files[ $asset->handle() ] = $asset;
100
+			}
101
+			$this->next();
102
+		}
103
+		$this->rewind();
104
+		return $files;
105
+	}
106
+
107
+
108
+	/**
109
+	 * returns TRUE or FALSE
110
+	 * depending on whether the object is within the Collection
111
+	 * based on the supplied $identifier and type
112
+	 *
113
+	 * @param  mixed $identifier
114
+	 * @param string $type
115
+	 * @return bool
116
+	 * @since 4.9.63.p
117
+	 */
118
+	public function hasAssetOfType($identifier, $type = Asset::TYPE_JS)
119
+	{
120
+		$this->rewind();
121
+		while ($this->valid()) {
122
+			if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
123
+				$this->rewind();
124
+				return true;
125
+			}
126
+			$this->next();
127
+		}
128
+		return false;
129
+	}
130
+
131
+
132
+	/**
133
+	 * returns TRUE or FALSE
134
+	 * depending on whether the Javascript Asset is within the Collection
135
+	 * based on the supplied $identifier
136
+	 *
137
+	 * @param  mixed $identifier
138
+	 * @return bool
139
+	 * @since 4.9.63.p
140
+	 */
141
+	public function hasJavascriptAsset($identifier)
142
+	{
143
+		return $this->hasAssetOfType($identifier, Asset::TYPE_JS);
144
+	}
145
+
146
+
147
+	/**
148
+	 * returns TRUE or FALSE
149
+	 * depending on whether the Stylesheet Asset is within the Collection
150
+	 * based on the supplied $identifier
151
+	 *
152
+	 * @param  mixed $identifier
153
+	 * @return bool
154
+	 * @since 4.9.63.p
155
+	 */
156
+	public function hasStylesheetAsset($identifier)
157
+	{
158
+		return $this->hasAssetOfType($identifier, Asset::TYPE_CSS);
159
+	}
160
+
161
+	/**
162
+	 * returns the object from the Collection
163
+	 * based on the supplied $identifier and type
164
+	 *
165
+	 * @param  mixed $identifier
166
+	 * @param string $type
167
+	 * @return JavascriptAsset|StylesheetAsset
168
+	 * @since 4.9.63.p
169
+	 */
170
+	public function getAssetOfType($identifier, $type = Asset::TYPE_JS)
171
+	{
172
+		$this->rewind();
173
+		while ($this->valid()) {
174
+			if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
175
+				/** @var JavascriptAsset|StylesheetAsset $object */
176
+				$object = $this->current();
177
+				$this->rewind();
178
+				return $object;
179
+			}
180
+			$this->next();
181
+		}
182
+		return null;
183
+	}
184
+
185
+
186
+	/**
187
+	 * returns the Stylesheet Asset from the Collection
188
+	 * based on the supplied $identifier
189
+	 *
190
+	 * @param  mixed $identifier
191
+	 * @return StylesheetAsset
192
+	 * @since 4.9.63.p
193
+	 */
194
+	public function getStylesheetAsset($identifier)
195
+	{
196
+		return $this->getAssetOfType($identifier, Asset::TYPE_CSS);
197
+	}
198
+
199
+
200
+	/**
201
+	 * returns the Javascript Asset from the Collection
202
+	 * based on the supplied $identifier
203
+	 *
204
+	 * @param  mixed $identifier
205
+	 * @return JavascriptAsset
206
+	 * @since 4.9.63.p
207
+	 */
208
+	public function getJavascriptAsset($identifier)
209
+	{
210
+		return $this->getAssetOfType($identifier, Asset::TYPE_JS);
211
+	}
212 212
 }
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/forms/PrivacySettingsFormHandler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
 use EEH_HTML;
14 14
 use EventEspresso\core\exceptions\InvalidFormSubmissionException;
15 15
 use EventEspresso\core\libraries\form_sections\form_handlers\FormHandler;
16
-use EventEspresso\core\services\loaders\LoaderFactory;
17 16
 
18 17
 /**
19 18
  * Class PrivacySettingsFormHandler
Please login to merge, or discard this patch.
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -28,112 +28,112 @@
 block discarded – undo
28 28
 class PrivacySettingsFormHandler extends FormHandler
29 29
 {
30 30
 
31
-    /**
32
-     * @var EE_Config
33
-     */
34
-    protected $config;
31
+	/**
32
+	 * @var EE_Config
33
+	 */
34
+	protected $config;
35 35
 
36 36
 
37
-    /**
38
-     * PrivacySettingsFormHandler constructor.
39
-     *
40
-     * @param EE_Registry $registry
41
-     * @param EE_Config   $config
42
-     */
43
-    public function __construct(EE_Registry $registry, EE_Config $config)
44
-    {
45
-        $this->config = $config;
46
-        parent::__construct(
47
-            esc_html__('Privacy Settings', 'event_espresso'),
48
-            esc_html__('Privacy Settings', 'event_espresso'),
49
-            'privacy-settings',
50
-            '',
51
-            FormHandler::DO_NOT_SETUP_FORM,
52
-            $registry
53
-        );
54
-    }
37
+	/**
38
+	 * PrivacySettingsFormHandler constructor.
39
+	 *
40
+	 * @param EE_Registry $registry
41
+	 * @param EE_Config   $config
42
+	 */
43
+	public function __construct(EE_Registry $registry, EE_Config $config)
44
+	{
45
+		$this->config = $config;
46
+		parent::__construct(
47
+			esc_html__('Privacy Settings', 'event_espresso'),
48
+			esc_html__('Privacy Settings', 'event_espresso'),
49
+			'privacy-settings',
50
+			'',
51
+			FormHandler::DO_NOT_SETUP_FORM,
52
+			$registry
53
+		);
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * creates and returns the actual form
59
-     *
60
-     * @return EE_Form_Section_Proper
61
-     */
62
-    public function generate()
63
-    {
64
-        // this form makes use of the session for passing around invalid form submission data, so make sure its enabled
65
-        add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false');
66
-        /**
67
-         * @var $reg_config EE_Registration_Config
68
-         */
69
-        $reg_config = $this->config->registration;
70
-        return new EE_Form_Section_Proper(
71
-            array(
72
-                'name'        => 'privacy_consent_settings',
73
-                'subsections' => array(
74
-                    'privacy_consent_form_hdr' => new EE_Form_Section_HTML(
75
-                        EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso'))
76
-                    ),
77
-                    'enable'                   => new EE_Select_Reveal_Input(
78
-                        array(
79
-                            'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'),
80
-                            'disable'                => esc_html__('Disabled', 'event_espresso'),
81
-                        ),
82
-                        array(
83
-                            'default'         => $reg_config->isConsentCheckboxEnabled()
84
-                                ? 'enable-privacy-consent'
85
-                                : 'disable',
86
-                            'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'),
87
-                            'html_help_text'  => esc_html__(
88
-                                'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.',
89
-                                'event_espresso'
90
-                            ),
91
-                        )
92
-                    ),
93
-                    'enable-privacy-consent'   => new EE_Form_Section_Proper(
94
-                        array(
95
-                            'subsections' => array(
96
-                                'consent_assertion' => new EE_Text_Area_Input(
97
-                                    array(
98
-                                        'default'               => $reg_config->getConsentCheckboxLabelText(),
99
-                                        'html_label_text'       => esc_html__('Consent Text', 'event_espresso'),
100
-                                        'html_help_text'        => esc_html__(
101
-                                            'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.',
102
-                                            'event_espresso'
103
-                                        ),
104
-                                        'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
105
-                                    )
106
-                                ),
107
-                            ),
108
-                        )
109
-                    ),
110
-                ),
111
-            )
112
-        );
113
-    }
57
+	/**
58
+	 * creates and returns the actual form
59
+	 *
60
+	 * @return EE_Form_Section_Proper
61
+	 */
62
+	public function generate()
63
+	{
64
+		// this form makes use of the session for passing around invalid form submission data, so make sure its enabled
65
+		add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false');
66
+		/**
67
+		 * @var $reg_config EE_Registration_Config
68
+		 */
69
+		$reg_config = $this->config->registration;
70
+		return new EE_Form_Section_Proper(
71
+			array(
72
+				'name'        => 'privacy_consent_settings',
73
+				'subsections' => array(
74
+					'privacy_consent_form_hdr' => new EE_Form_Section_HTML(
75
+						EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso'))
76
+					),
77
+					'enable'                   => new EE_Select_Reveal_Input(
78
+						array(
79
+							'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'),
80
+							'disable'                => esc_html__('Disabled', 'event_espresso'),
81
+						),
82
+						array(
83
+							'default'         => $reg_config->isConsentCheckboxEnabled()
84
+								? 'enable-privacy-consent'
85
+								: 'disable',
86
+							'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'),
87
+							'html_help_text'  => esc_html__(
88
+								'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.',
89
+								'event_espresso'
90
+							),
91
+						)
92
+					),
93
+					'enable-privacy-consent'   => new EE_Form_Section_Proper(
94
+						array(
95
+							'subsections' => array(
96
+								'consent_assertion' => new EE_Text_Area_Input(
97
+									array(
98
+										'default'               => $reg_config->getConsentCheckboxLabelText(),
99
+										'html_label_text'       => esc_html__('Consent Text', 'event_espresso'),
100
+										'html_help_text'        => esc_html__(
101
+											'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.',
102
+											'event_espresso'
103
+										),
104
+										'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
105
+									)
106
+								),
107
+							),
108
+						)
109
+					),
110
+				),
111
+			)
112
+		);
113
+	}
114 114
 
115 115
 
116
-    /**
117
-     * After validating the form data, update the registration config
118
-     *
119
-     * @param array $submitted_form_data
120
-     * @return bool
121
-     */
122
-    public function process($submitted_form_data = array())
123
-    {
124
-        try {
125
-            $valid_data = parent::process($submitted_form_data);
126
-            $reg_config = $this->config->registration;
127
-            $reg_config->setConsentCheckboxEnabled($valid_data['enable'] === 'enable-privacy-consent');
128
-            $reg_config->setConsentCheckboxLabelText(
129
-                $valid_data['enable-privacy-consent']['consent_assertion']
130
-            );
131
-            return $this->config->update_espresso_config(false, false);
132
-        } catch (InvalidFormSubmissionException $e) {
133
-            // the form was invalid, it should be re-displayed with errors
134
-            return false;
135
-        }
136
-    }
116
+	/**
117
+	 * After validating the form data, update the registration config
118
+	 *
119
+	 * @param array $submitted_form_data
120
+	 * @return bool
121
+	 */
122
+	public function process($submitted_form_data = array())
123
+	{
124
+		try {
125
+			$valid_data = parent::process($submitted_form_data);
126
+			$reg_config = $this->config->registration;
127
+			$reg_config->setConsentCheckboxEnabled($valid_data['enable'] === 'enable-privacy-consent');
128
+			$reg_config->setConsentCheckboxLabelText(
129
+				$valid_data['enable-privacy-consent']['consent_assertion']
130
+			);
131
+			return $this->config->update_espresso_config(false, false);
132
+		} catch (InvalidFormSubmissionException $e) {
133
+			// the form was invalid, it should be re-displayed with errors
134
+			return false;
135
+		}
136
+	}
137 137
 }
138 138
 // End of file PrivacySettingsFormHandler.php
139 139
 // Location: EventEspresso\core\domain\services\admin\privacy\forms/PrivacySettingsFormHandler.php
Please login to merge, or discard this patch.
core/services/privacy/policy/PrivacyPolicyManager.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -24,70 +24,70 @@
 block discarded – undo
24 24
 class PrivacyPolicyManager
25 25
 {
26 26
 
27
-    public function __construct()
28
-    {
29
-        add_action('current_screen', array($this, 'addPrivacyPolicy'), 9);
30
-    }
27
+	public function __construct()
28
+	{
29
+		add_action('current_screen', array($this, 'addPrivacyPolicy'), 9);
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * For all the registered `PrivacyPolicyInterface`s, add their privacy policy content
35
-     *
36
-     * @param WP_Screen $screen
37
-     * @throws InvalidClassException
38
-     * @throws InvalidDataTypeException
39
-     * @throws InvalidEntityException
40
-     * @throws InvalidFilePathException
41
-     * @throws InvalidIdentifierException
42
-     * @throws InvalidInterfaceException
43
-     */
44
-    public function addPrivacyPolicy(WP_Screen $screen)
45
-    {
46
-        if ($screen instanceof WP_Screen
47
-            && $screen->id === 'tools'
48
-            && isset($_GET['wp-privacy-policy-guide'])) {
49
-            // load all the privacy policy stuff
50
-            // add post policy text
51
-            foreach ($this->loadPrivacyPolicyCollection() as $privacy_policy) {
52
-                wp_add_privacy_policy_content($privacy_policy->getName(), $privacy_policy->getContent());
53
-            }
54
-        }
55
-    }
33
+	/**
34
+	 * For all the registered `PrivacyPolicyInterface`s, add their privacy policy content
35
+	 *
36
+	 * @param WP_Screen $screen
37
+	 * @throws InvalidClassException
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws InvalidEntityException
40
+	 * @throws InvalidFilePathException
41
+	 * @throws InvalidIdentifierException
42
+	 * @throws InvalidInterfaceException
43
+	 */
44
+	public function addPrivacyPolicy(WP_Screen $screen)
45
+	{
46
+		if ($screen instanceof WP_Screen
47
+			&& $screen->id === 'tools'
48
+			&& isset($_GET['wp-privacy-policy-guide'])) {
49
+			// load all the privacy policy stuff
50
+			// add post policy text
51
+			foreach ($this->loadPrivacyPolicyCollection() as $privacy_policy) {
52
+				wp_add_privacy_policy_content($privacy_policy->getName(), $privacy_policy->getContent());
53
+			}
54
+		}
55
+	}
56 56
 
57 57
 
58
-    /**
59
-     * @return CollectionInterface|PrivacyPolicyInterface[]
60
-     * @throws InvalidIdentifierException
61
-     * @throws InvalidInterfaceException
62
-     * @throws InvalidFilePathException
63
-     * @throws InvalidEntityException
64
-     * @throws InvalidDataTypeException
65
-     * @throws InvalidClassException
66
-     */
67
-    protected function loadPrivacyPolicyCollection()
68
-    {
69
-        $loader = new CollectionLoader(
70
-            new CollectionDetails(
71
-                // collection name
72
-                'privacy_policies',
73
-                // collection interface
74
-                'EventEspresso\core\services\privacy\policy\PrivacyPolicyInterface',
75
-                // FQCNs for classes to add (all classes within that namespace will be loaded)
76
-                apply_filters(
77
-                    'FHEE__EventEspresso_core_services_privacy_policy_PrivacyPolicyManager__privacy_policies',
78
-                    array('EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy')
79
-                ),
80
-                // filepaths to classes to add
81
-                array(),
82
-                // file mask to use if parsing folder for files to add
83
-                '',
84
-                // what to use as identifier for collection entities
85
-                // using CLASS NAME prevents duplicates (works like a singleton)
86
-                CollectionDetails::ID_CLASS_NAME
87
-            )
88
-        );
89
-        return $loader->getCollection();
90
-    }
58
+	/**
59
+	 * @return CollectionInterface|PrivacyPolicyInterface[]
60
+	 * @throws InvalidIdentifierException
61
+	 * @throws InvalidInterfaceException
62
+	 * @throws InvalidFilePathException
63
+	 * @throws InvalidEntityException
64
+	 * @throws InvalidDataTypeException
65
+	 * @throws InvalidClassException
66
+	 */
67
+	protected function loadPrivacyPolicyCollection()
68
+	{
69
+		$loader = new CollectionLoader(
70
+			new CollectionDetails(
71
+				// collection name
72
+				'privacy_policies',
73
+				// collection interface
74
+				'EventEspresso\core\services\privacy\policy\PrivacyPolicyInterface',
75
+				// FQCNs for classes to add (all classes within that namespace will be loaded)
76
+				apply_filters(
77
+					'FHEE__EventEspresso_core_services_privacy_policy_PrivacyPolicyManager__privacy_policies',
78
+					array('EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy')
79
+				),
80
+				// filepaths to classes to add
81
+				array(),
82
+				// file mask to use if parsing folder for files to add
83
+				'',
84
+				// what to use as identifier for collection entities
85
+				// using CLASS NAME prevents duplicates (works like a singleton)
86
+				CollectionDetails::ID_CLASS_NAME
87
+			)
88
+		);
89
+		return $loader->getCollection();
90
+	}
91 91
 }
92 92
 // End of file PrivacyPolicyManager.php
93 93
 // Location: EventEspresso\core\domain\services\admin/PrivacyPolicyManager.php
Please login to merge, or discard this patch.
core/CPTs/CptQueryModifier.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
             $all_taxonomies = $taxonomy_definitions->getCustomTaxonomyDefinitions();
286 286
             foreach ($taxonomies as $taxonomy => &$details) {
287 287
                 // add details to our taxonomies if they exist
288
-                $details = isset($all_taxonomies[ $taxonomy ])
289
-                    ? $all_taxonomies[ $taxonomy ]
288
+                $details = isset($all_taxonomies[$taxonomy])
289
+                    ? $all_taxonomies[$taxonomy]
290 290
                     : array();
291 291
             }
292 292
             // ALWAYS unset() variables that were passed by reference
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         add_filter('posts_fields', array($this, 'postsFields'));
324 324
         add_filter('posts_join', array($this, 'postsJoin'));
325 325
         add_filter(
326
-            'get_' . $this->post_type . '_metadata',
326
+            'get_'.$this->post_type.'_metadata',
327 327
             array($CPT_Strategy, 'get_EE_post_type_metadata'),
328 328
             1,
329 329
             4
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     public function setRequestVarsIfCpt()
375 375
     {
376 376
         // check if ee action var has been set
377
-        if (! $this->request->requestParamIsSet('ee')) {
377
+        if ( ! $this->request->requestParamIsSet('ee')) {
378 378
             // check that route exists for CPT archive slug
379 379
             if (is_archive() && EE_Config::get_route($this->cpt_details['plural_slug'])) {
380 380
                 // ie: set "ee" to "events"
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
     {
400 400
         // get CPT table data via CPT Model
401 401
         $full_model_name = strpos($model_name, 'EEM_') !== 0
402
-            ? 'EEM_' . $model_name
402
+            ? 'EEM_'.$model_name
403 403
             : $model_name;
404 404
         $model = $this->loader->getShared($full_model_name);
405
-        if (! $model instanceof EEM_Base) {
405
+        if ( ! $model instanceof EEM_Base) {
406 406
             throw new EE_Error(
407 407
                 sprintf(
408 408
                     __(
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
         }
416 416
         $this->setModel($model);
417 417
         $this->setModelTables($this->model->get_tables());
418
-        $meta_model = $model_name . '_Meta';
418
+        $meta_model = $model_name.'_Meta';
419 419
         // is there a Meta Table for this CPT?
420
-        if (isset($this->cpt_details['tables'][ $meta_model ])
421
-            && $this->cpt_details['tables'][ $meta_model ] instanceof EE_Secondary_Table
420
+        if (isset($this->cpt_details['tables'][$meta_model])
421
+            && $this->cpt_details['tables'][$meta_model] instanceof EE_Secondary_Table
422 422
         ) {
423
-            $this->setMetaTable($this->cpt_details['tables'][ $meta_model ]);
423
+            $this->setMetaTable($this->cpt_details['tables'][$meta_model]);
424 424
         }
425 425
     }
426 426
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
     protected function cptStrategyClass($model_name)
436 436
     {
437 437
         // creates classname like:  CPT_Event_Strategy
438
-        $CPT_Strategy_class_name = 'EE_CPT_' . $model_name . '_Strategy';
438
+        $CPT_Strategy_class_name = 'EE_CPT_'.$model_name.'_Strategy';
439 439
         // load and instantiate
440 440
         $CPT_Strategy = $this->loader->getShared(
441 441
             $CPT_Strategy_class_name,
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         // does this CPT have a meta table ?
464 464
         if ($this->meta_table instanceof EE_Secondary_Table) {
465 465
             // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
466
-            $SQL .= ', ' . $this->meta_table->get_table_name() . '.* ';
466
+            $SQL .= ', '.$this->meta_table->get_table_name().'.* ';
467 467
         }
468 468
         remove_filter('posts_fields', array($this, 'postsFields'));
469 469
         return $SQL;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         global $post;
533 533
         // notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui
534 534
         // for interacting with the CPT is desired and there is no EE UI for interacting with the CPT in the admin.
535
-        if (! $post instanceof WP_Post
535
+        if ( ! $post instanceof WP_Post
536 536
             || $post->post_type !== $this->post_type
537 537
             || (
538 538
                 isset($this->cpt_details['args']['show_ee_ui'])
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     public function addTemplateFilters()
563 563
     {
564 564
         // if requested cpt supports page_templates and it's the main query
565
-        if (! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
565
+        if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
566 566
             // then let's hook into the appropriate query_template hook
567 567
             add_filter('single_template', array($this, 'singleCptTemplate'));
568 568
         }
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
         // exit early if default or not set or invalid path (accounts for theme changes)
587 587
         if ($template === 'default'
588 588
             || empty($template)
589
-            || ! is_readable(get_stylesheet_directory() . '/' . $template)
589
+            || ! is_readable(get_stylesheet_directory().'/'.$template)
590 590
         ) {
591 591
             return $current_template;
592 592
         }
Please login to merge, or discard this patch.
Indentation   +565 added lines, -565 removed lines patch added patch discarded remove patch
@@ -28,569 +28,569 @@
 block discarded – undo
28 28
 class CptQueryModifier
29 29
 {
30 30
 
31
-    /**
32
-     * @var string $post_type
33
-     */
34
-    protected $post_type = '';
35
-
36
-    /**
37
-     * CPT details from CustomPostTypeDefinitions for specific post type
38
-     *
39
-     * @var array $cpt_details
40
-     */
41
-    protected $cpt_details = array();
42
-
43
-    /**
44
-     * @var EE_Table_Base[] $model_tables
45
-     */
46
-    protected $model_tables = array();
47
-
48
-    /**
49
-     * @var array $taxonomies
50
-     */
51
-    protected $taxonomies = array();
52
-
53
-    /**
54
-     * meta table for the related CPT
55
-     *
56
-     * @var EE_Secondary_Table $meta_table
57
-     */
58
-    protected $meta_table;
59
-
60
-    /**
61
-     * EEM_CPT_Base model for the related CPT
62
-     *
63
-     * @var EEM_CPT_Base $model
64
-     */
65
-    protected $model;
66
-
67
-    /**
68
-     * @var EE_Request_Handler $request_handler
69
-     */
70
-    protected $request_handler;
71
-
72
-    /**
73
-     * @var WP_Query $wp_query
74
-     */
75
-    protected $wp_query;
76
-
77
-    /**
78
-     * @var LoaderInterface $loader
79
-     */
80
-    protected $loader;
81
-
82
-    /**
83
-     * @var RequestInterface $request
84
-     */
85
-    protected $request;
86
-
87
-
88
-    /**
89
-     * CptQueryModifier constructor
90
-     *
91
-     * @param string             $post_type
92
-     * @param array              $cpt_details
93
-     * @param WP_Query           $WP_Query
94
-     * @param EE_Request_Handler $request_handler
95
-     * @param RequestInterface   $request
96
-     * @param LoaderInterface    $loader
97
-     * @throws EE_Error
98
-     */
99
-    public function __construct(
100
-        $post_type,
101
-        array $cpt_details,
102
-        WP_Query $WP_Query,
103
-        EE_Request_Handler $request_handler,
104
-        RequestInterface $request,
105
-        LoaderInterface $loader
106
-    ) {
107
-        $this->loader = $loader;
108
-        $this->request = $request;
109
-        $this->request_handler = $request_handler;
110
-        $this->setWpQuery($WP_Query);
111
-        $this->setPostType($post_type);
112
-        $this->setCptDetails($cpt_details);
113
-        $this->init();
114
-    }
115
-
116
-
117
-    /**
118
-     * @return string
119
-     */
120
-    public function postType()
121
-    {
122
-        return $this->post_type;
123
-    }
124
-
125
-
126
-    /**
127
-     * @param string $post_type
128
-     */
129
-    protected function setPostType($post_type)
130
-    {
131
-        $this->post_type = $post_type;
132
-    }
133
-
134
-
135
-    /**
136
-     * @return array
137
-     */
138
-    public function cptDetails()
139
-    {
140
-        return $this->cpt_details;
141
-    }
142
-
143
-
144
-    /**
145
-     * @param array $cpt_details
146
-     */
147
-    protected function setCptDetails($cpt_details)
148
-    {
149
-        $this->cpt_details = $cpt_details;
150
-    }
151
-
152
-
153
-    /**
154
-     * @return EE_Table_Base[]
155
-     */
156
-    public function modelTables()
157
-    {
158
-        return $this->model_tables;
159
-    }
160
-
161
-
162
-    /**
163
-     * @param EE_Table_Base[] $model_tables
164
-     */
165
-    protected function setModelTables($model_tables)
166
-    {
167
-        $this->model_tables = $model_tables;
168
-    }
169
-
170
-
171
-    /**
172
-     * @return array
173
-     * @throws InvalidArgumentException
174
-     * @throws InvalidDataTypeException
175
-     * @throws InvalidInterfaceException
176
-     */
177
-    public function taxonomies()
178
-    {
179
-        if (empty($this->taxonomies)) {
180
-            $this->initializeTaxonomies();
181
-        }
182
-        return $this->taxonomies;
183
-    }
184
-
185
-
186
-    /**
187
-     * @param array $taxonomies
188
-     */
189
-    protected function setTaxonomies(array $taxonomies)
190
-    {
191
-        $this->taxonomies = $taxonomies;
192
-    }
193
-
194
-
195
-    /**
196
-     * @return EE_Secondary_Table
197
-     */
198
-    public function metaTable()
199
-    {
200
-        return $this->meta_table;
201
-    }
202
-
203
-
204
-    /**
205
-     * @param EE_Secondary_Table $meta_table
206
-     */
207
-    public function setMetaTable(EE_Secondary_Table $meta_table)
208
-    {
209
-        $this->meta_table = $meta_table;
210
-    }
211
-
212
-
213
-    /**
214
-     * @return EEM_Base
215
-     */
216
-    public function model()
217
-    {
218
-        return $this->model;
219
-    }
220
-
221
-
222
-    /**
223
-     * @param EEM_Base $CPT_model
224
-     */
225
-    protected function setModel(EEM_Base $CPT_model)
226
-    {
227
-        $this->model = $CPT_model;
228
-    }
229
-
230
-
231
-    /**
232
-     * @deprecated 4.9.63.p
233
-     * @return EE_Request_Handler
234
-     */
235
-    public function request()
236
-    {
237
-        return $this->request_handler;
238
-    }
239
-
240
-
241
-
242
-    // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
243
-
244
-
245
-    /**
246
-     * @return WP_Query
247
-     */
248
-    public function WpQuery()
249
-    {
250
-        return $this->wp_query;
251
-    }
252
-    // phpcs:enable
253
-
254
-
255
-    /**
256
-     * @param WP_Query $wp_query
257
-     */
258
-    public function setWpQuery(WP_Query $wp_query)
259
-    {
260
-        $this->wp_query = $wp_query;
261
-    }
262
-
263
-
264
-    /**
265
-     * @return void
266
-     * @throws InvalidDataTypeException
267
-     * @throws InvalidInterfaceException
268
-     * @throws InvalidArgumentException
269
-     */
270
-    protected function initializeTaxonomies()
271
-    {
272
-        // check if taxonomies have already been set and that this CPT has taxonomies registered for it
273
-        if (empty($this->taxonomies)
274
-            && isset($this->cpt_details['args']['taxonomies'])
275
-        ) {
276
-            // if so then grab them, but we want the taxonomy name as the key
277
-            $taxonomies = array_flip($this->cpt_details['args']['taxonomies']);
278
-            // then grab the list of ALL taxonomies
279
-            /** @var \EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions
280
-             * $taxonomy_definitions
281
-             */
282
-            $taxonomy_definitions = $this->loader->getShared(
283
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions'
284
-            );
285
-            $all_taxonomies = $taxonomy_definitions->getCustomTaxonomyDefinitions();
286
-            foreach ($taxonomies as $taxonomy => &$details) {
287
-                // add details to our taxonomies if they exist
288
-                $details = isset($all_taxonomies[ $taxonomy ])
289
-                    ? $all_taxonomies[ $taxonomy ]
290
-                    : array();
291
-            }
292
-            // ALWAYS unset() variables that were passed by reference
293
-            unset($details);
294
-            $this->setTaxonomies($taxonomies);
295
-        }
296
-    }
297
-
298
-
299
-    /**
300
-     * @since 4.9.63.p
301
-     * @throws EE_Error
302
-     */
303
-    protected function init()
304
-    {
305
-        $this->setAdditionalCptDetails();
306
-        $this->setRequestVarsIfCpt();
307
-        // convert post_type to model name
308
-        $model_name = str_replace('EE_', '', $this->cpt_details['class_name']);
309
-        // load all tables related to CPT
310
-        $this->setupModelsAndTables($model_name);
311
-        // load and instantiate CPT_*_Strategy
312
-        $CPT_Strategy = $this->cptStrategyClass($model_name);
313
-        // !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
314
-        // here's the list of available filters in the WP_Query object
315
-        // 'posts_where_paged'
316
-        // 'posts_groupby'
317
-        // 'posts_join_paged'
318
-        // 'posts_orderby'
319
-        // 'posts_distinct'
320
-        // 'post_limits'
321
-        // 'posts_fields'
322
-        // 'posts_join'
323
-        add_filter('posts_fields', array($this, 'postsFields'));
324
-        add_filter('posts_join', array($this, 'postsJoin'));
325
-        add_filter(
326
-            'get_' . $this->post_type . '_metadata',
327
-            array($CPT_Strategy, 'get_EE_post_type_metadata'),
328
-            1,
329
-            4
330
-        );
331
-        add_filter('the_posts', array($this, 'thePosts'), 1, 1);
332
-        if ($this->wp_query->is_main_query()) {
333
-            add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2);
334
-            $this->addTemplateFilters();
335
-        }
336
-    }
337
-
338
-
339
-    /**
340
-     * sets some basic query vars that pertain to the CPT
341
-     *
342
-     * @access protected
343
-     * @return void
344
-     */
345
-    protected function setAdditionalCptDetails()
346
-    {
347
-        // the post or category or term that is triggering EE
348
-        $this->cpt_details['espresso_page'] = $this->request_handler->is_espresso_page();
349
-        // requested post name
350
-        $this->cpt_details['post_name'] = $this->request->getRequestParam('post_name');
351
-        // add support for viewing 'private', 'draft', or 'pending' posts
352
-        if (isset($this->wp_query->query_vars['p'])
353
-            && $this->wp_query->query_vars['p'] !== 0
354
-            && is_user_logged_in()
355
-            && current_user_can('edit_post', $this->wp_query->query_vars['p'])
356
-        ) {
357
-            // we can just inject directly into the WP_Query object
358
-            $this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
359
-            // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
360
-            $this->request->setRequestParam('ee', $this->cpt_details['singular_slug']);
361
-        }
362
-    }
363
-
364
-
365
-    /**
366
-     * Checks if we're on a EE-CPT archive-or-single page, and if we've never set the EE request var.
367
-     * If so, sets the 'ee' request variable
368
-     * so other parts of EE can know what CPT is getting queried.
369
-     * To Mike's knowledge, this must be called from during or after the pre_get_posts hook
370
-     * in order for is_archive() and is_single() methods to work properly.
371
-     *
372
-     * @return void
373
-     */
374
-    public function setRequestVarsIfCpt()
375
-    {
376
-        // check if ee action var has been set
377
-        if (! $this->request->requestParamIsSet('ee')) {
378
-            // check that route exists for CPT archive slug
379
-            if (is_archive() && EE_Config::get_route($this->cpt_details['plural_slug'])) {
380
-                // ie: set "ee" to "events"
381
-                $this->request->setRequestParam('ee', $this->cpt_details['plural_slug']);
382
-                // or does it match a single page CPT like /event/
383
-            } elseif (is_single() && EE_Config::get_route($this->cpt_details['singular_slug'])) {
384
-                // ie: set "ee" to "event"
385
-                $this->request->setRequestParam('ee', $this->cpt_details['singular_slug']);
386
-            }
387
-        }
388
-    }
389
-
390
-
391
-    /**
392
-     * setupModelsAndTables
393
-     *
394
-     * @access protected
395
-     * @param string $model_name
396
-     * @throws EE_Error
397
-     */
398
-    protected function setupModelsAndTables($model_name)
399
-    {
400
-        // get CPT table data via CPT Model
401
-        $full_model_name = strpos($model_name, 'EEM_') !== 0
402
-            ? 'EEM_' . $model_name
403
-            : $model_name;
404
-        $model = $this->loader->getShared($full_model_name);
405
-        if (! $model instanceof EEM_Base) {
406
-            throw new EE_Error(
407
-                sprintf(
408
-                    __(
409
-                        'The "%1$s" model could not be loaded.',
410
-                        'event_espresso'
411
-                    ),
412
-                    $full_model_name
413
-                )
414
-            );
415
-        }
416
-        $this->setModel($model);
417
-        $this->setModelTables($this->model->get_tables());
418
-        $meta_model = $model_name . '_Meta';
419
-        // is there a Meta Table for this CPT?
420
-        if (isset($this->cpt_details['tables'][ $meta_model ])
421
-            && $this->cpt_details['tables'][ $meta_model ] instanceof EE_Secondary_Table
422
-        ) {
423
-            $this->setMetaTable($this->cpt_details['tables'][ $meta_model ]);
424
-        }
425
-    }
426
-
427
-
428
-    /**
429
-     * cptStrategyClass
430
-     *
431
-     * @access protected
432
-     * @param  string $model_name
433
-     * @return string
434
-     */
435
-    protected function cptStrategyClass($model_name)
436
-    {
437
-        // creates classname like:  CPT_Event_Strategy
438
-        $CPT_Strategy_class_name = 'EE_CPT_' . $model_name . '_Strategy';
439
-        // load and instantiate
440
-        $CPT_Strategy = $this->loader->getShared(
441
-            $CPT_Strategy_class_name,
442
-            array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
443
-        );
444
-        if ($CPT_Strategy === null) {
445
-            $CPT_Strategy = $this->loader->getShared(
446
-                'EE_CPT_Default_Strategy',
447
-                array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
448
-            );
449
-        }
450
-        return $CPT_Strategy;
451
-    }
452
-
453
-
454
-    /**
455
-     * postsFields
456
-     *
457
-     * @access public
458
-     * @param  $SQL
459
-     * @return string
460
-     */
461
-    public function postsFields($SQL)
462
-    {
463
-        // does this CPT have a meta table ?
464
-        if ($this->meta_table instanceof EE_Secondary_Table) {
465
-            // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
466
-            $SQL .= ', ' . $this->meta_table->get_table_name() . '.* ';
467
-        }
468
-        remove_filter('posts_fields', array($this, 'postsFields'));
469
-        return $SQL;
470
-    }
471
-
472
-
473
-    /**
474
-     * postsJoin
475
-     *
476
-     * @access public
477
-     * @param  $SQL
478
-     * @return string
479
-     */
480
-    public function postsJoin($SQL)
481
-    {
482
-        // does this CPT have a meta table ?
483
-        if ($this->meta_table instanceof EE_Secondary_Table) {
484
-            global $wpdb;
485
-            // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
486
-            $SQL .= ' LEFT JOIN '
487
-                    . $this->meta_table->get_table_name()
488
-                    . ' ON ( '
489
-                    . $this->meta_table->get_table_name()
490
-                    . '.'
491
-                    . $this->meta_table->get_fk_on_table()
492
-                    . ' = '
493
-                    . $wpdb->posts
494
-                    . '.ID ) ';
495
-        }
496
-        remove_filter('posts_join', array($this, 'postsJoin'));
497
-        return $SQL;
498
-    }
499
-
500
-
501
-    /**
502
-     * thePosts
503
-     *
504
-     * @access public
505
-     * @param  WP_Post[] $posts
506
-     * @return WP_Post[]
507
-     */
508
-    public function thePosts($posts)
509
-    {
510
-        $CPT_class = $this->cpt_details['class_name'];
511
-        // loop thru posts
512
-        if (is_array($posts) && $this->model instanceof EEM_CPT_Base) {
513
-            foreach ($posts as $key => $post) {
514
-                if ($post->post_type === $this->post_type) {
515
-                    $post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post);
516
-                }
517
-            }
518
-        }
519
-        remove_filter('the_posts', array($this, 'thePosts'), 1);
520
-        return $posts;
521
-    }
522
-
523
-
524
-    /**
525
-     * @param $url
526
-     * @param $ID
527
-     * @return string
528
-     */
529
-    public function getEditPostLink($url, $ID)
530
-    {
531
-        // need to make sure we only edit links if our cpt
532
-        global $post;
533
-        // notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui
534
-        // for interacting with the CPT is desired and there is no EE UI for interacting with the CPT in the admin.
535
-        if (! $post instanceof WP_Post
536
-            || $post->post_type !== $this->post_type
537
-            || (
538
-                isset($this->cpt_details['args']['show_ee_ui'])
539
-                && ! $this->cpt_details['args']['show_ee_ui']
540
-            )
541
-        ) {
542
-            return $url;
543
-        }
544
-        // k made it here so all is good.
545
-        return wp_nonce_url(
546
-            add_query_arg(
547
-                array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'),
548
-                admin_url('admin.php')
549
-            ),
550
-            'edit',
551
-            'edit_nonce'
552
-        );
553
-    }
554
-
555
-
556
-    /**
557
-     * Execute any template filters.
558
-     * This method is only called if in main query.
559
-     *
560
-     * @return void
561
-     */
562
-    public function addTemplateFilters()
563
-    {
564
-        // if requested cpt supports page_templates and it's the main query
565
-        if (! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
566
-            // then let's hook into the appropriate query_template hook
567
-            add_filter('single_template', array($this, 'singleCptTemplate'));
568
-        }
569
-    }
570
-
571
-
572
-    /**
573
-     * Callback for single_template wp filter.
574
-     * This is used to load the set page_template for a single ee cpt if its set.  If "default" then we load the normal
575
-     * hierarchy.
576
-     *
577
-     * @access public
578
-     * @param string $current_template Existing default template path derived for this page call.
579
-     * @return string the path to the full template file.
580
-     */
581
-    public function singleCptTemplate($current_template)
582
-    {
583
-        $object = get_queried_object();
584
-        // does this called object HAVE a page template set that is something other than the default.
585
-        $template = get_post_meta($object->ID, '_wp_page_template', true);
586
-        // exit early if default or not set or invalid path (accounts for theme changes)
587
-        if ($template === 'default'
588
-            || empty($template)
589
-            || ! is_readable(get_stylesheet_directory() . '/' . $template)
590
-        ) {
591
-            return $current_template;
592
-        }
593
-        // made it here so we SHOULD be able to just locate the template and then return it.
594
-        return locate_template(array($template));
595
-    }
31
+	/**
32
+	 * @var string $post_type
33
+	 */
34
+	protected $post_type = '';
35
+
36
+	/**
37
+	 * CPT details from CustomPostTypeDefinitions for specific post type
38
+	 *
39
+	 * @var array $cpt_details
40
+	 */
41
+	protected $cpt_details = array();
42
+
43
+	/**
44
+	 * @var EE_Table_Base[] $model_tables
45
+	 */
46
+	protected $model_tables = array();
47
+
48
+	/**
49
+	 * @var array $taxonomies
50
+	 */
51
+	protected $taxonomies = array();
52
+
53
+	/**
54
+	 * meta table for the related CPT
55
+	 *
56
+	 * @var EE_Secondary_Table $meta_table
57
+	 */
58
+	protected $meta_table;
59
+
60
+	/**
61
+	 * EEM_CPT_Base model for the related CPT
62
+	 *
63
+	 * @var EEM_CPT_Base $model
64
+	 */
65
+	protected $model;
66
+
67
+	/**
68
+	 * @var EE_Request_Handler $request_handler
69
+	 */
70
+	protected $request_handler;
71
+
72
+	/**
73
+	 * @var WP_Query $wp_query
74
+	 */
75
+	protected $wp_query;
76
+
77
+	/**
78
+	 * @var LoaderInterface $loader
79
+	 */
80
+	protected $loader;
81
+
82
+	/**
83
+	 * @var RequestInterface $request
84
+	 */
85
+	protected $request;
86
+
87
+
88
+	/**
89
+	 * CptQueryModifier constructor
90
+	 *
91
+	 * @param string             $post_type
92
+	 * @param array              $cpt_details
93
+	 * @param WP_Query           $WP_Query
94
+	 * @param EE_Request_Handler $request_handler
95
+	 * @param RequestInterface   $request
96
+	 * @param LoaderInterface    $loader
97
+	 * @throws EE_Error
98
+	 */
99
+	public function __construct(
100
+		$post_type,
101
+		array $cpt_details,
102
+		WP_Query $WP_Query,
103
+		EE_Request_Handler $request_handler,
104
+		RequestInterface $request,
105
+		LoaderInterface $loader
106
+	) {
107
+		$this->loader = $loader;
108
+		$this->request = $request;
109
+		$this->request_handler = $request_handler;
110
+		$this->setWpQuery($WP_Query);
111
+		$this->setPostType($post_type);
112
+		$this->setCptDetails($cpt_details);
113
+		$this->init();
114
+	}
115
+
116
+
117
+	/**
118
+	 * @return string
119
+	 */
120
+	public function postType()
121
+	{
122
+		return $this->post_type;
123
+	}
124
+
125
+
126
+	/**
127
+	 * @param string $post_type
128
+	 */
129
+	protected function setPostType($post_type)
130
+	{
131
+		$this->post_type = $post_type;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @return array
137
+	 */
138
+	public function cptDetails()
139
+	{
140
+		return $this->cpt_details;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param array $cpt_details
146
+	 */
147
+	protected function setCptDetails($cpt_details)
148
+	{
149
+		$this->cpt_details = $cpt_details;
150
+	}
151
+
152
+
153
+	/**
154
+	 * @return EE_Table_Base[]
155
+	 */
156
+	public function modelTables()
157
+	{
158
+		return $this->model_tables;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param EE_Table_Base[] $model_tables
164
+	 */
165
+	protected function setModelTables($model_tables)
166
+	{
167
+		$this->model_tables = $model_tables;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @return array
173
+	 * @throws InvalidArgumentException
174
+	 * @throws InvalidDataTypeException
175
+	 * @throws InvalidInterfaceException
176
+	 */
177
+	public function taxonomies()
178
+	{
179
+		if (empty($this->taxonomies)) {
180
+			$this->initializeTaxonomies();
181
+		}
182
+		return $this->taxonomies;
183
+	}
184
+
185
+
186
+	/**
187
+	 * @param array $taxonomies
188
+	 */
189
+	protected function setTaxonomies(array $taxonomies)
190
+	{
191
+		$this->taxonomies = $taxonomies;
192
+	}
193
+
194
+
195
+	/**
196
+	 * @return EE_Secondary_Table
197
+	 */
198
+	public function metaTable()
199
+	{
200
+		return $this->meta_table;
201
+	}
202
+
203
+
204
+	/**
205
+	 * @param EE_Secondary_Table $meta_table
206
+	 */
207
+	public function setMetaTable(EE_Secondary_Table $meta_table)
208
+	{
209
+		$this->meta_table = $meta_table;
210
+	}
211
+
212
+
213
+	/**
214
+	 * @return EEM_Base
215
+	 */
216
+	public function model()
217
+	{
218
+		return $this->model;
219
+	}
220
+
221
+
222
+	/**
223
+	 * @param EEM_Base $CPT_model
224
+	 */
225
+	protected function setModel(EEM_Base $CPT_model)
226
+	{
227
+		$this->model = $CPT_model;
228
+	}
229
+
230
+
231
+	/**
232
+	 * @deprecated 4.9.63.p
233
+	 * @return EE_Request_Handler
234
+	 */
235
+	public function request()
236
+	{
237
+		return $this->request_handler;
238
+	}
239
+
240
+
241
+
242
+	// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
243
+
244
+
245
+	/**
246
+	 * @return WP_Query
247
+	 */
248
+	public function WpQuery()
249
+	{
250
+		return $this->wp_query;
251
+	}
252
+	// phpcs:enable
253
+
254
+
255
+	/**
256
+	 * @param WP_Query $wp_query
257
+	 */
258
+	public function setWpQuery(WP_Query $wp_query)
259
+	{
260
+		$this->wp_query = $wp_query;
261
+	}
262
+
263
+
264
+	/**
265
+	 * @return void
266
+	 * @throws InvalidDataTypeException
267
+	 * @throws InvalidInterfaceException
268
+	 * @throws InvalidArgumentException
269
+	 */
270
+	protected function initializeTaxonomies()
271
+	{
272
+		// check if taxonomies have already been set and that this CPT has taxonomies registered for it
273
+		if (empty($this->taxonomies)
274
+			&& isset($this->cpt_details['args']['taxonomies'])
275
+		) {
276
+			// if so then grab them, but we want the taxonomy name as the key
277
+			$taxonomies = array_flip($this->cpt_details['args']['taxonomies']);
278
+			// then grab the list of ALL taxonomies
279
+			/** @var \EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions
280
+			 * $taxonomy_definitions
281
+			 */
282
+			$taxonomy_definitions = $this->loader->getShared(
283
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions'
284
+			);
285
+			$all_taxonomies = $taxonomy_definitions->getCustomTaxonomyDefinitions();
286
+			foreach ($taxonomies as $taxonomy => &$details) {
287
+				// add details to our taxonomies if they exist
288
+				$details = isset($all_taxonomies[ $taxonomy ])
289
+					? $all_taxonomies[ $taxonomy ]
290
+					: array();
291
+			}
292
+			// ALWAYS unset() variables that were passed by reference
293
+			unset($details);
294
+			$this->setTaxonomies($taxonomies);
295
+		}
296
+	}
297
+
298
+
299
+	/**
300
+	 * @since 4.9.63.p
301
+	 * @throws EE_Error
302
+	 */
303
+	protected function init()
304
+	{
305
+		$this->setAdditionalCptDetails();
306
+		$this->setRequestVarsIfCpt();
307
+		// convert post_type to model name
308
+		$model_name = str_replace('EE_', '', $this->cpt_details['class_name']);
309
+		// load all tables related to CPT
310
+		$this->setupModelsAndTables($model_name);
311
+		// load and instantiate CPT_*_Strategy
312
+		$CPT_Strategy = $this->cptStrategyClass($model_name);
313
+		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
314
+		// here's the list of available filters in the WP_Query object
315
+		// 'posts_where_paged'
316
+		// 'posts_groupby'
317
+		// 'posts_join_paged'
318
+		// 'posts_orderby'
319
+		// 'posts_distinct'
320
+		// 'post_limits'
321
+		// 'posts_fields'
322
+		// 'posts_join'
323
+		add_filter('posts_fields', array($this, 'postsFields'));
324
+		add_filter('posts_join', array($this, 'postsJoin'));
325
+		add_filter(
326
+			'get_' . $this->post_type . '_metadata',
327
+			array($CPT_Strategy, 'get_EE_post_type_metadata'),
328
+			1,
329
+			4
330
+		);
331
+		add_filter('the_posts', array($this, 'thePosts'), 1, 1);
332
+		if ($this->wp_query->is_main_query()) {
333
+			add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2);
334
+			$this->addTemplateFilters();
335
+		}
336
+	}
337
+
338
+
339
+	/**
340
+	 * sets some basic query vars that pertain to the CPT
341
+	 *
342
+	 * @access protected
343
+	 * @return void
344
+	 */
345
+	protected function setAdditionalCptDetails()
346
+	{
347
+		// the post or category or term that is triggering EE
348
+		$this->cpt_details['espresso_page'] = $this->request_handler->is_espresso_page();
349
+		// requested post name
350
+		$this->cpt_details['post_name'] = $this->request->getRequestParam('post_name');
351
+		// add support for viewing 'private', 'draft', or 'pending' posts
352
+		if (isset($this->wp_query->query_vars['p'])
353
+			&& $this->wp_query->query_vars['p'] !== 0
354
+			&& is_user_logged_in()
355
+			&& current_user_can('edit_post', $this->wp_query->query_vars['p'])
356
+		) {
357
+			// we can just inject directly into the WP_Query object
358
+			$this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
359
+			// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
360
+			$this->request->setRequestParam('ee', $this->cpt_details['singular_slug']);
361
+		}
362
+	}
363
+
364
+
365
+	/**
366
+	 * Checks if we're on a EE-CPT archive-or-single page, and if we've never set the EE request var.
367
+	 * If so, sets the 'ee' request variable
368
+	 * so other parts of EE can know what CPT is getting queried.
369
+	 * To Mike's knowledge, this must be called from during or after the pre_get_posts hook
370
+	 * in order for is_archive() and is_single() methods to work properly.
371
+	 *
372
+	 * @return void
373
+	 */
374
+	public function setRequestVarsIfCpt()
375
+	{
376
+		// check if ee action var has been set
377
+		if (! $this->request->requestParamIsSet('ee')) {
378
+			// check that route exists for CPT archive slug
379
+			if (is_archive() && EE_Config::get_route($this->cpt_details['plural_slug'])) {
380
+				// ie: set "ee" to "events"
381
+				$this->request->setRequestParam('ee', $this->cpt_details['plural_slug']);
382
+				// or does it match a single page CPT like /event/
383
+			} elseif (is_single() && EE_Config::get_route($this->cpt_details['singular_slug'])) {
384
+				// ie: set "ee" to "event"
385
+				$this->request->setRequestParam('ee', $this->cpt_details['singular_slug']);
386
+			}
387
+		}
388
+	}
389
+
390
+
391
+	/**
392
+	 * setupModelsAndTables
393
+	 *
394
+	 * @access protected
395
+	 * @param string $model_name
396
+	 * @throws EE_Error
397
+	 */
398
+	protected function setupModelsAndTables($model_name)
399
+	{
400
+		// get CPT table data via CPT Model
401
+		$full_model_name = strpos($model_name, 'EEM_') !== 0
402
+			? 'EEM_' . $model_name
403
+			: $model_name;
404
+		$model = $this->loader->getShared($full_model_name);
405
+		if (! $model instanceof EEM_Base) {
406
+			throw new EE_Error(
407
+				sprintf(
408
+					__(
409
+						'The "%1$s" model could not be loaded.',
410
+						'event_espresso'
411
+					),
412
+					$full_model_name
413
+				)
414
+			);
415
+		}
416
+		$this->setModel($model);
417
+		$this->setModelTables($this->model->get_tables());
418
+		$meta_model = $model_name . '_Meta';
419
+		// is there a Meta Table for this CPT?
420
+		if (isset($this->cpt_details['tables'][ $meta_model ])
421
+			&& $this->cpt_details['tables'][ $meta_model ] instanceof EE_Secondary_Table
422
+		) {
423
+			$this->setMetaTable($this->cpt_details['tables'][ $meta_model ]);
424
+		}
425
+	}
426
+
427
+
428
+	/**
429
+	 * cptStrategyClass
430
+	 *
431
+	 * @access protected
432
+	 * @param  string $model_name
433
+	 * @return string
434
+	 */
435
+	protected function cptStrategyClass($model_name)
436
+	{
437
+		// creates classname like:  CPT_Event_Strategy
438
+		$CPT_Strategy_class_name = 'EE_CPT_' . $model_name . '_Strategy';
439
+		// load and instantiate
440
+		$CPT_Strategy = $this->loader->getShared(
441
+			$CPT_Strategy_class_name,
442
+			array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
443
+		);
444
+		if ($CPT_Strategy === null) {
445
+			$CPT_Strategy = $this->loader->getShared(
446
+				'EE_CPT_Default_Strategy',
447
+				array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
448
+			);
449
+		}
450
+		return $CPT_Strategy;
451
+	}
452
+
453
+
454
+	/**
455
+	 * postsFields
456
+	 *
457
+	 * @access public
458
+	 * @param  $SQL
459
+	 * @return string
460
+	 */
461
+	public function postsFields($SQL)
462
+	{
463
+		// does this CPT have a meta table ?
464
+		if ($this->meta_table instanceof EE_Secondary_Table) {
465
+			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
466
+			$SQL .= ', ' . $this->meta_table->get_table_name() . '.* ';
467
+		}
468
+		remove_filter('posts_fields', array($this, 'postsFields'));
469
+		return $SQL;
470
+	}
471
+
472
+
473
+	/**
474
+	 * postsJoin
475
+	 *
476
+	 * @access public
477
+	 * @param  $SQL
478
+	 * @return string
479
+	 */
480
+	public function postsJoin($SQL)
481
+	{
482
+		// does this CPT have a meta table ?
483
+		if ($this->meta_table instanceof EE_Secondary_Table) {
484
+			global $wpdb;
485
+			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
486
+			$SQL .= ' LEFT JOIN '
487
+					. $this->meta_table->get_table_name()
488
+					. ' ON ( '
489
+					. $this->meta_table->get_table_name()
490
+					. '.'
491
+					. $this->meta_table->get_fk_on_table()
492
+					. ' = '
493
+					. $wpdb->posts
494
+					. '.ID ) ';
495
+		}
496
+		remove_filter('posts_join', array($this, 'postsJoin'));
497
+		return $SQL;
498
+	}
499
+
500
+
501
+	/**
502
+	 * thePosts
503
+	 *
504
+	 * @access public
505
+	 * @param  WP_Post[] $posts
506
+	 * @return WP_Post[]
507
+	 */
508
+	public function thePosts($posts)
509
+	{
510
+		$CPT_class = $this->cpt_details['class_name'];
511
+		// loop thru posts
512
+		if (is_array($posts) && $this->model instanceof EEM_CPT_Base) {
513
+			foreach ($posts as $key => $post) {
514
+				if ($post->post_type === $this->post_type) {
515
+					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post);
516
+				}
517
+			}
518
+		}
519
+		remove_filter('the_posts', array($this, 'thePosts'), 1);
520
+		return $posts;
521
+	}
522
+
523
+
524
+	/**
525
+	 * @param $url
526
+	 * @param $ID
527
+	 * @return string
528
+	 */
529
+	public function getEditPostLink($url, $ID)
530
+	{
531
+		// need to make sure we only edit links if our cpt
532
+		global $post;
533
+		// notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui
534
+		// for interacting with the CPT is desired and there is no EE UI for interacting with the CPT in the admin.
535
+		if (! $post instanceof WP_Post
536
+			|| $post->post_type !== $this->post_type
537
+			|| (
538
+				isset($this->cpt_details['args']['show_ee_ui'])
539
+				&& ! $this->cpt_details['args']['show_ee_ui']
540
+			)
541
+		) {
542
+			return $url;
543
+		}
544
+		// k made it here so all is good.
545
+		return wp_nonce_url(
546
+			add_query_arg(
547
+				array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'),
548
+				admin_url('admin.php')
549
+			),
550
+			'edit',
551
+			'edit_nonce'
552
+		);
553
+	}
554
+
555
+
556
+	/**
557
+	 * Execute any template filters.
558
+	 * This method is only called if in main query.
559
+	 *
560
+	 * @return void
561
+	 */
562
+	public function addTemplateFilters()
563
+	{
564
+		// if requested cpt supports page_templates and it's the main query
565
+		if (! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
566
+			// then let's hook into the appropriate query_template hook
567
+			add_filter('single_template', array($this, 'singleCptTemplate'));
568
+		}
569
+	}
570
+
571
+
572
+	/**
573
+	 * Callback for single_template wp filter.
574
+	 * This is used to load the set page_template for a single ee cpt if its set.  If "default" then we load the normal
575
+	 * hierarchy.
576
+	 *
577
+	 * @access public
578
+	 * @param string $current_template Existing default template path derived for this page call.
579
+	 * @return string the path to the full template file.
580
+	 */
581
+	public function singleCptTemplate($current_template)
582
+	{
583
+		$object = get_queried_object();
584
+		// does this called object HAVE a page template set that is something other than the default.
585
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
586
+		// exit early if default or not set or invalid path (accounts for theme changes)
587
+		if ($template === 'default'
588
+			|| empty($template)
589
+			|| ! is_readable(get_stylesheet_directory() . '/' . $template)
590
+		) {
591
+			return $current_template;
592
+		}
593
+		// made it here so we SHOULD be able to just locate the template and then return it.
594
+		return locate_template(array($template));
595
+	}
596 596
 }
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Event_Strategy.core.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
             )
122 122
         ) {
123 123
             // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
124
-            $SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ';
124
+            $SQL .= ', '.EEM_Datetime::instance()->table().'.* ';
125 125
             if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) {
126 126
                 // because we only want to retrieve the next upcoming datetime for each event:
127 127
                 // add something like:
128 128
                 // ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date "
129 129
                 // to WP Query SELECT statement
130
-                $SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ';
130
+                $SQL .= ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date ';
131 131
             }
132 132
         }
133 133
         return $SQL;
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
             // adds something like:
157 157
             // " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) "
158 158
             // to WP Query JOIN statement
159
-            $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table()
160
-                    . '.ID = ' . EEM_Datetime::instance()->table() . '.'
161
-                    . EEM_Event::instance()->primary_key_name() . ' ) ';
159
+            $SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table()
160
+                    . '.ID = '.EEM_Datetime::instance()->table().'.'
161
+                    . EEM_Event::instance()->primary_key_name().' ) ';
162 162
         }
163 163
         return $SQL;
164 164
     }
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
                 || $wp_query->is_espresso_event_taxonomy
183 183
             )
184 184
         ) {
185
-            if (! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive)
185
+            if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive)
186 186
                 || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events)
187 187
                 || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events
188 188
             ) {
189
-                $SQL .= ' AND ' . EEM_Datetime::instance()->table() . ".DTT_EVT_end > '"
190
-                        . current_time('mysql', true) . "' ";
189
+                $SQL .= ' AND '.EEM_Datetime::instance()->table().".DTT_EVT_end > '"
190
+                        . current_time('mysql', true)."' ";
191 191
             }
192 192
         }
193 193
         return $SQL;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             // but we want to only show each event only once
234 234
             // (whereas if we didn't group them by the post's ID, then we would end up with many repeats)
235 235
             global $wpdb;
236
-            $SQL = $wpdb->posts . '.ID ';
236
+            $SQL = $wpdb->posts.'.ID ';
237 237
         }
238 238
         return $SQL;
239 239
     }
Please login to merge, or discard this patch.
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -13,252 +13,252 @@
 block discarded – undo
13 13
 class EE_CPT_Event_Strategy
14 14
 {
15 15
 
16
-    /**
17
-     * the current page, if it utilizes CPTs
18
-     *
19
-     * @var object $CPT
20
-     */
21
-    protected $CPT;
16
+	/**
17
+	 * the current page, if it utilizes CPTs
18
+	 *
19
+	 * @var object $CPT
20
+	 */
21
+	protected $CPT;
22 22
 
23 23
 
24
-    /**
25
-     * @param WP_Query $wp_query
26
-     * @param array    $CPT
27
-     */
28
-    public function __construct($wp_query, $CPT = array())
29
-    {
30
-        if ($wp_query instanceof WP_Query) {
31
-            $WP_Query = $wp_query;
32
-            $this->CPT = $CPT;
33
-        } else {
34
-            $WP_Query = isset($wp_query['WP_Query']) ? $wp_query['WP_Query'] : null;
35
-            $this->CPT = isset($wp_query['CPT']) ? $wp_query['CPT'] : null;
36
-        }
37
-        // !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
38
-        // here's the list of available filters in the WP_Query object
39
-        // 'posts_where'
40
-        // 'posts_where_paged'
41
-        // 'posts_groupby'
42
-        // 'posts_join_paged'
43
-        // 'posts_orderby'
44
-        // 'posts_distinct'
45
-        // 'post_limits'
46
-        // 'posts_fields'
47
-        // 'posts_join'
48
-        $this->_add_filters();
49
-        if ($WP_Query instanceof WP_Query) {
50
-            $WP_Query->is_espresso_event_single = is_singular()
51
-                                                  && isset($WP_Query->query->post_type)
52
-                                                  && $WP_Query->query->post_type === 'espresso_events';
53
-            $WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events');
54
-            $WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories');
55
-        }
56
-    }
24
+	/**
25
+	 * @param WP_Query $wp_query
26
+	 * @param array    $CPT
27
+	 */
28
+	public function __construct($wp_query, $CPT = array())
29
+	{
30
+		if ($wp_query instanceof WP_Query) {
31
+			$WP_Query = $wp_query;
32
+			$this->CPT = $CPT;
33
+		} else {
34
+			$WP_Query = isset($wp_query['WP_Query']) ? $wp_query['WP_Query'] : null;
35
+			$this->CPT = isset($wp_query['CPT']) ? $wp_query['CPT'] : null;
36
+		}
37
+		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
38
+		// here's the list of available filters in the WP_Query object
39
+		// 'posts_where'
40
+		// 'posts_where_paged'
41
+		// 'posts_groupby'
42
+		// 'posts_join_paged'
43
+		// 'posts_orderby'
44
+		// 'posts_distinct'
45
+		// 'post_limits'
46
+		// 'posts_fields'
47
+		// 'posts_join'
48
+		$this->_add_filters();
49
+		if ($WP_Query instanceof WP_Query) {
50
+			$WP_Query->is_espresso_event_single = is_singular()
51
+												  && isset($WP_Query->query->post_type)
52
+												  && $WP_Query->query->post_type === 'espresso_events';
53
+			$WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events');
54
+			$WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories');
55
+		}
56
+	}
57 57
 
58 58
 
59
-    /**
60
-     * When an instance of this class is created, we add our filters
61
-     * (which will get removed in case the next call to get_posts ISN'T
62
-     * for event CPTs)
63
-     */
64
-    protected function _add_filters()
65
-    {
66
-        add_filter('posts_fields', array($this, 'posts_fields'), 1, 2);
67
-        add_filter('posts_join', array($this, 'posts_join'), 1, 2);
68
-        add_filter('posts_where', array($this, 'posts_where'), 10, 2);
69
-        // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
70
-        add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2);
71
-        add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2);
72
-        add_action('posts_selection', array($this, 'remove_filters'));
73
-    }
59
+	/**
60
+	 * When an instance of this class is created, we add our filters
61
+	 * (which will get removed in case the next call to get_posts ISN'T
62
+	 * for event CPTs)
63
+	 */
64
+	protected function _add_filters()
65
+	{
66
+		add_filter('posts_fields', array($this, 'posts_fields'), 1, 2);
67
+		add_filter('posts_join', array($this, 'posts_join'), 1, 2);
68
+		add_filter('posts_where', array($this, 'posts_where'), 10, 2);
69
+		// add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
70
+		add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2);
71
+		add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2);
72
+		add_action('posts_selection', array($this, 'remove_filters'));
73
+	}
74 74
 
75 75
 
76
-    /**
77
-     * public access to _remove_filters()
78
-     *
79
-     * @since 4.9.63.p
80
-     */
81
-    public function remove_filters()
82
-    {
83
-        $this->_remove_filters();
84
-    }
76
+	/**
77
+	 * public access to _remove_filters()
78
+	 *
79
+	 * @since 4.9.63.p
80
+	 */
81
+	public function remove_filters()
82
+	{
83
+		$this->_remove_filters();
84
+	}
85 85
 
86 86
 
87
-    /**
88
-     * Should eb called when the last filter or hook is fired for this CPT strategy.
89
-     * This is to avoid applying this CPT strategy for other posts or CPTs (eg,
90
-     * we don't want to join to the datetime table when querying for venues, do we!?)
91
-     */
92
-    protected function _remove_filters()
93
-    {
94
-        remove_filter('posts_fields', array($this, 'posts_fields'), 1);
95
-        remove_filter('posts_join', array($this, 'posts_join'), 1);
96
-        remove_filter('posts_where', array($this, 'posts_where'), 10);
97
-        // remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 );
98
-        remove_filter('posts_orderby', array($this, 'posts_orderby'), 1);
99
-        remove_filter('posts_groupby', array($this, 'posts_groupby'), 1);
100
-        remove_action('posts_selection', array($this, 'remove_filters'));
101
-    }
87
+	/**
88
+	 * Should eb called when the last filter or hook is fired for this CPT strategy.
89
+	 * This is to avoid applying this CPT strategy for other posts or CPTs (eg,
90
+	 * we don't want to join to the datetime table when querying for venues, do we!?)
91
+	 */
92
+	protected function _remove_filters()
93
+	{
94
+		remove_filter('posts_fields', array($this, 'posts_fields'), 1);
95
+		remove_filter('posts_join', array($this, 'posts_join'), 1);
96
+		remove_filter('posts_where', array($this, 'posts_where'), 10);
97
+		// remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 );
98
+		remove_filter('posts_orderby', array($this, 'posts_orderby'), 1);
99
+		remove_filter('posts_groupby', array($this, 'posts_groupby'), 1);
100
+		remove_action('posts_selection', array($this, 'remove_filters'));
101
+	}
102 102
 
103 103
 
104
-    /**
105
-     * @param string   $SQL
106
-     * @param WP_Query $wp_query
107
-     * @return    string
108
-     * @throws EE_Error
109
-     * @throws InvalidArgumentException
110
-     * @throws InvalidDataTypeException
111
-     * @throws InvalidInterfaceException
112
-     */
113
-    public function posts_fields($SQL, WP_Query $wp_query)
114
-    {
115
-        if ($wp_query instanceof WP_Query
116
-            &&
117
-            (
118
-                $wp_query->is_espresso_event_single
119
-                || $wp_query->is_espresso_event_archive
120
-                || $wp_query->is_espresso_event_taxonomy
121
-            )
122
-        ) {
123
-            // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
124
-            $SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ';
125
-            if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) {
126
-                // because we only want to retrieve the next upcoming datetime for each event:
127
-                // add something like:
128
-                // ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date "
129
-                // to WP Query SELECT statement
130
-                $SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ';
131
-            }
132
-        }
133
-        return $SQL;
134
-    }
104
+	/**
105
+	 * @param string   $SQL
106
+	 * @param WP_Query $wp_query
107
+	 * @return    string
108
+	 * @throws EE_Error
109
+	 * @throws InvalidArgumentException
110
+	 * @throws InvalidDataTypeException
111
+	 * @throws InvalidInterfaceException
112
+	 */
113
+	public function posts_fields($SQL, WP_Query $wp_query)
114
+	{
115
+		if ($wp_query instanceof WP_Query
116
+			&&
117
+			(
118
+				$wp_query->is_espresso_event_single
119
+				|| $wp_query->is_espresso_event_archive
120
+				|| $wp_query->is_espresso_event_taxonomy
121
+			)
122
+		) {
123
+			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
124
+			$SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ';
125
+			if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) {
126
+				// because we only want to retrieve the next upcoming datetime for each event:
127
+				// add something like:
128
+				// ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date "
129
+				// to WP Query SELECT statement
130
+				$SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ';
131
+			}
132
+		}
133
+		return $SQL;
134
+	}
135 135
 
136 136
 
137
-    /**
138
-     * @param string   $SQL
139
-     * @param WP_Query $wp_query
140
-     * @return string
141
-     * @throws EE_Error
142
-     * @throws InvalidArgumentException
143
-     * @throws InvalidDataTypeException
144
-     * @throws InvalidInterfaceException
145
-     */
146
-    public function posts_join($SQL, WP_Query $wp_query)
147
-    {
148
-        if ($wp_query instanceof WP_Query
149
-            &&
150
-            (
151
-                $wp_query->is_espresso_event_single
152
-                || $wp_query->is_espresso_event_archive
153
-                || $wp_query->is_espresso_event_taxonomy
154
-            )
155
-        ) {
156
-            // adds something like:
157
-            // " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) "
158
-            // to WP Query JOIN statement
159
-            $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table()
160
-                    . '.ID = ' . EEM_Datetime::instance()->table() . '.'
161
-                    . EEM_Event::instance()->primary_key_name() . ' ) ';
162
-        }
163
-        return $SQL;
164
-    }
137
+	/**
138
+	 * @param string   $SQL
139
+	 * @param WP_Query $wp_query
140
+	 * @return string
141
+	 * @throws EE_Error
142
+	 * @throws InvalidArgumentException
143
+	 * @throws InvalidDataTypeException
144
+	 * @throws InvalidInterfaceException
145
+	 */
146
+	public function posts_join($SQL, WP_Query $wp_query)
147
+	{
148
+		if ($wp_query instanceof WP_Query
149
+			&&
150
+			(
151
+				$wp_query->is_espresso_event_single
152
+				|| $wp_query->is_espresso_event_archive
153
+				|| $wp_query->is_espresso_event_taxonomy
154
+			)
155
+		) {
156
+			// adds something like:
157
+			// " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) "
158
+			// to WP Query JOIN statement
159
+			$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table()
160
+					. '.ID = ' . EEM_Datetime::instance()->table() . '.'
161
+					. EEM_Event::instance()->primary_key_name() . ' ) ';
162
+		}
163
+		return $SQL;
164
+	}
165 165
 
166 166
 
167
-    /**
168
-     * @param string   $SQL
169
-     * @param WP_Query $wp_query
170
-     * @return string
171
-     * @throws EE_Error
172
-     * @throws InvalidArgumentException
173
-     * @throws InvalidDataTypeException
174
-     * @throws InvalidInterfaceException
175
-     */
176
-    public function posts_where($SQL, WP_Query $wp_query)
177
-    {
178
-        if ($wp_query instanceof WP_Query
179
-            &&
180
-            (
181
-                $wp_query->is_espresso_event_archive
182
-                || $wp_query->is_espresso_event_taxonomy
183
-            )
184
-        ) {
185
-            if (! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive)
186
-                || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events)
187
-                || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events
188
-            ) {
189
-                $SQL .= ' AND ' . EEM_Datetime::instance()->table() . ".DTT_EVT_end > '"
190
-                        . current_time('mysql', true) . "' ";
191
-            }
192
-        }
193
-        return $SQL;
194
-    }
167
+	/**
168
+	 * @param string   $SQL
169
+	 * @param WP_Query $wp_query
170
+	 * @return string
171
+	 * @throws EE_Error
172
+	 * @throws InvalidArgumentException
173
+	 * @throws InvalidDataTypeException
174
+	 * @throws InvalidInterfaceException
175
+	 */
176
+	public function posts_where($SQL, WP_Query $wp_query)
177
+	{
178
+		if ($wp_query instanceof WP_Query
179
+			&&
180
+			(
181
+				$wp_query->is_espresso_event_archive
182
+				|| $wp_query->is_espresso_event_taxonomy
183
+			)
184
+		) {
185
+			if (! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive)
186
+				|| ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events)
187
+				|| ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events
188
+			) {
189
+				$SQL .= ' AND ' . EEM_Datetime::instance()->table() . ".DTT_EVT_end > '"
190
+						. current_time('mysql', true) . "' ";
191
+			}
192
+		}
193
+		return $SQL;
194
+	}
195 195
 
196 196
 
197
-    /**
198
-     * @param string   $SQL
199
-     * @param WP_Query $wp_query
200
-     * @return string
201
-     */
202
-    public function posts_orderby($SQL, WP_Query $wp_query)
203
-    {
204
-        if ($wp_query instanceof WP_Query
205
-            &&
206
-            (
207
-                $wp_query->is_espresso_event_archive
208
-                || $wp_query->is_espresso_event_taxonomy
209
-            )
210
-        ) {
211
-            $SQL = ' event_start_date ASC ';
212
-        }
213
-        return $SQL;
214
-    }
197
+	/**
198
+	 * @param string   $SQL
199
+	 * @param WP_Query $wp_query
200
+	 * @return string
201
+	 */
202
+	public function posts_orderby($SQL, WP_Query $wp_query)
203
+	{
204
+		if ($wp_query instanceof WP_Query
205
+			&&
206
+			(
207
+				$wp_query->is_espresso_event_archive
208
+				|| $wp_query->is_espresso_event_taxonomy
209
+			)
210
+		) {
211
+			$SQL = ' event_start_date ASC ';
212
+		}
213
+		return $SQL;
214
+	}
215 215
 
216 216
 
217
-    /**
218
-     * @param string   $SQL
219
-     * @param WP_Query $wp_query
220
-     * @return string
221
-     */
222
-    public function posts_groupby($SQL, WP_Query $wp_query)
223
-    {
224
-        if ($wp_query instanceof WP_Query
225
-            &&
226
-            (
227
-                $wp_query->is_espresso_event_archive
228
-                || $wp_query->is_espresso_event_taxonomy
229
-            )
230
-        ) {
231
-            // TODO: add event list option for displaying ALL datetimes in event list or only primary datetime (default)
232
-            // we're joining to the datetimes table, where there can be MANY datetimes for a single event,
233
-            // but we want to only show each event only once
234
-            // (whereas if we didn't group them by the post's ID, then we would end up with many repeats)
235
-            global $wpdb;
236
-            $SQL = $wpdb->posts . '.ID ';
237
-        }
238
-        return $SQL;
239
-    }
217
+	/**
218
+	 * @param string   $SQL
219
+	 * @param WP_Query $wp_query
220
+	 * @return string
221
+	 */
222
+	public function posts_groupby($SQL, WP_Query $wp_query)
223
+	{
224
+		if ($wp_query instanceof WP_Query
225
+			&&
226
+			(
227
+				$wp_query->is_espresso_event_archive
228
+				|| $wp_query->is_espresso_event_taxonomy
229
+			)
230
+		) {
231
+			// TODO: add event list option for displaying ALL datetimes in event list or only primary datetime (default)
232
+			// we're joining to the datetimes table, where there can be MANY datetimes for a single event,
233
+			// but we want to only show each event only once
234
+			// (whereas if we didn't group them by the post's ID, then we would end up with many repeats)
235
+			global $wpdb;
236
+			$SQL = $wpdb->posts . '.ID ';
237
+		}
238
+		return $SQL;
239
+	}
240 240
 
241 241
 
242
-    /**
243
-     * @param array    $posts
244
-     * @param WP_Query $wp_query
245
-     * @return array
246
-     */
247
-    public function the_posts($posts, WP_Query $wp_query)
248
-    {
249
-        return $posts;
250
-    }
242
+	/**
243
+	 * @param array    $posts
244
+	 * @param WP_Query $wp_query
245
+	 * @return array
246
+	 */
247
+	public function the_posts($posts, WP_Query $wp_query)
248
+	{
249
+		return $posts;
250
+	}
251 251
 
252 252
 
253
-    /**
254
-     * @param null $meta_value
255
-     * @param      $post_id
256
-     * @param      $meta_key
257
-     * @param      $single
258
-     * @return    string
259
-     */
260
-    public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single)
261
-    {
262
-        return $meta_value;
263
-    }
253
+	/**
254
+	 * @param null $meta_value
255
+	 * @param      $post_id
256
+	 * @param      $meta_key
257
+	 * @param      $single
258
+	 * @return    string
259
+	 */
260
+	public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single)
261
+	{
262
+		return $meta_value;
263
+	}
264 264
 }
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/policy/privacy_policy.template.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 ?>
8 8
 <h2><?php esc_html_e('Event Registration Data', 'event_espresso'); ?></h2>
9 9
 <p><?php
10
-    esc_html_e(
11
-        'We collect information about you during event registration. This information may include but is not limited to:',
12
-        'event_espresso'
13
-    ); ?></p>
10
+	esc_html_e(
11
+		'We collect information about you during event registration. This information may include but is not limited to:',
12
+		'event_espresso'
13
+	); ?></p>
14 14
 <ul>
15 15
     <li><?php esc_html_e('Your names', 'event_espresso'); ?></li>
16 16
     <li><?php esc_html_e('Billing address', 'event_espresso'); ?></li>
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
     <li><?php esc_html_e('Phone number', 'event_espresso'); ?></li>
20 20
     <li><?php esc_html_e('Location and traffic data (including partial IP address and browser type)', 'event_espresso'); ?></li>
21 21
     <li><?php
22
-        esc_html_e(
23
-            'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase',
24
-            'event_espresso'
25
-        ); ?></li>
22
+		esc_html_e(
23
+			'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase',
24
+			'event_espresso'
25
+		); ?></li>
26 26
 </ul>
27 27
 
28 28
 <p><?php esc_html_e('Handling this data also allows us to:', 'event_espresso'); ?></p>
@@ -30,102 +30,102 @@  discard block
 block discarded – undo
30 30
     <li><?php esc_html_e('Send you important account/purchase/service information.', 'event_espresso'); ?></li>
31 31
     <li><?php esc_html_e('Respond to your queries, refund requests, or complaints.', 'event_espresso'); ?></li>
32 32
     <li><?php
33
-        esc_html_e(
34
-            'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.',
35
-            'event_espresso'
36
-        ); ?></li>
33
+		esc_html_e(
34
+			'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.',
35
+			'event_espresso'
36
+		); ?></li>
37 37
     <li><?php
38
-        esc_html_e(
39
-            'Set up and administer your account, provide technical and customer support, and to verify your identity.',
40
-            'event_espresso'
41
-        ); ?></li>
38
+		esc_html_e(
39
+			'Set up and administer your account, provide technical and customer support, and to verify your identity.',
40
+			'event_espresso'
41
+		); ?></li>
42 42
 </ul>
43 43
 
44 44
 <?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?>
45 45
     <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2>
46 46
     <?php
47 47
 // if onsite or offsite payment methods are active
48
-    if (! empty($active_onsite_payment_methods)) { ?>
48
+	if (! empty($active_onsite_payment_methods)) { ?>
49 49
         <p><?php
50
-            esc_html_e(
51
-                'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.',
52
-                'event_espresso'
53
-            ); ?></p>
50
+			esc_html_e(
51
+				'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.',
52
+				'event_espresso'
53
+			); ?></p>
54 54
         <p><?php
55
-            printf(
56
-                esc_html_x(
57
-                    'Please see the privacy policy of %1$s.',
58
-                    'Please see the privacy policy of PayPal Pro',
59
-                    'event_espresso'
60
-                ),
61
-                implode(
62
-                    ', ',
63
-                    array_merge(
64
-                        $active_onsite_payment_methods,
65
-                        $active_offsite_payment_methods
66
-                    )
67
-                )
68
-            ); ?></p>
55
+			printf(
56
+				esc_html_x(
57
+					'Please see the privacy policy of %1$s.',
58
+					'Please see the privacy policy of PayPal Pro',
59
+					'event_espresso'
60
+				),
61
+				implode(
62
+					', ',
63
+					array_merge(
64
+						$active_onsite_payment_methods,
65
+						$active_offsite_payment_methods
66
+					)
67
+				)
68
+			); ?></p>
69 69
         <p><?php
70
-            esc_html_e(
71
-                'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).',
72
-                'event_espresso'
73
-            ); ?></p>
70
+			esc_html_e(
71
+				'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).',
72
+				'event_espresso'
73
+			); ?></p>
74 74
     <?php } // IF OFFSITE PAYMENT METHOD ACTIVE
75
-    elseif (! empty($active_offsite_payment_methods)) { ?>
75
+	elseif (! empty($active_offsite_payment_methods)) { ?>
76 76
         <p><?php
77
-            printf(
78
-                esc_html_x(
79
-                    'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.',
80
-                    'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.',
81
-                    'event_espresso'
82
-                ),
83
-                implode(', ', $active_offsite_payment_methods)
84
-            ); ?></p>
77
+			printf(
78
+				esc_html_x(
79
+					'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.',
80
+					'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.',
81
+					'event_espresso'
82
+				),
83
+				implode(', ', $active_offsite_payment_methods)
84
+			); ?></p>
85 85
     <?php } ?>
86 86
     <h2><?php esc_html_e('Payment Logging', 'event_espresso'); ?></h2>
87 87
     <p><?php
88
-        esc_html_e(
89
-            'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.',
90
-            'event_espresso'
91
-        ); ?></p>
88
+		esc_html_e(
89
+			'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.',
90
+			'event_espresso'
91
+		); ?></p>
92 92
 <?php } ?>
93 93
 
94 94
 <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso'); ?></h2>
95 95
 <p><?php
96
-    printf(
97
-        esc_html_x(
98
-            'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.',
99
-            'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.',
100
-            'event_espresso'
101
-        ),
102
-        $session_lifespan
103
-    ); ?></p>
96
+	printf(
97
+		esc_html_x(
98
+			'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.',
99
+			'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.',
100
+			'event_espresso'
101
+		),
102
+		$session_lifespan
103
+	); ?></p>
104 104
 
105 105
 <h2><?php esc_html_e('Email History Data', 'event_espresso'); ?></h2>
106 106
 <p><?php
107
-    esc_html_e(
108
-        'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.',
109
-        'event_espresso'
110
-    ); ?></p>
107
+	esc_html_e(
108
+		'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.',
109
+		'event_espresso'
110
+	); ?></p>
111 111
 
112 112
 <h2><?php esc_html_e('Event Check-In Record', 'event_espresso'); ?></h2>
113 113
 <p><?php
114
-    esc_html_e(
115
-        'When you attend an event, an event manager may record the time you check in or out of the event.',
116
-        'event_espresso'
117
-    ); ?></p>
114
+	esc_html_e(
115
+		'When you attend an event, an event manager may record the time you check in or out of the event.',
116
+		'event_espresso'
117
+	); ?></p>
118 118
 
119 119
 <h2><?php esc_html_e('Event Registration Data Retention', 'event_espresso'); ?></h2>
120 120
 <p><?php
121
-    esc_html_e(
122
-        'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.',
123
-        'event_espresso'
124
-    ); ?></p>
121
+	esc_html_e(
122
+		'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.',
123
+		'event_espresso'
124
+	); ?></p>
125 125
 
126 126
 <h2><?php esc_html_e('Event Registration Data Erasure and Export', 'event_espresso'); ?></h2>
127 127
 <p><?php
128
-    esc_html_e(
129
-        'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.',
130
-        'event_espresso'
131
-    ); ?></p>
128
+	esc_html_e(
129
+		'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.',
130
+		'event_espresso'
131
+	); ?></p>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
         ); ?></li>
42 42
 </ul>
43 43
 
44
-<?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?>
44
+<?php if ( ! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?>
45 45
     <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2>
46 46
     <?php
47 47
 // if onsite or offsite payment methods are active
48
-    if (! empty($active_onsite_payment_methods)) { ?>
48
+    if ( ! empty($active_onsite_payment_methods)) { ?>
49 49
         <p><?php
50 50
             esc_html_e(
51 51
                 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.',
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 'event_espresso'
73 73
             ); ?></p>
74 74
     <?php } // IF OFFSITE PAYMENT METHOD ACTIVE
75
-    elseif (! empty($active_offsite_payment_methods)) { ?>
75
+    elseif ( ! empty($active_offsite_payment_methods)) { ?>
76 76
         <p><?php
77 77
             printf(
78 78
                 esc_html_x(
Please login to merge, or discard this patch.
admin_pages/general_settings/OrganizationSettings.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
         $this->organization_config->instagram = isset($form_data['organization_instagram'])
448 448
             ? esc_url_raw($form_data['organization_instagram'])
449 449
             : $this->organization_config->instagram;
450
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
451
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
450
+        $this->core_config->ee_ueip_optin = isset($form_data[EE_Core_Config::OPTION_NAME_UXIP][0])
451
+            ? filter_var($form_data[EE_Core_Config::OPTION_NAME_UXIP][0], FILTER_VALIDATE_BOOLEAN)
452 452
             : false;
453 453
         $this->core_config->ee_ueip_has_notified = true;
454 454
 
@@ -479,10 +479,10 @@  discard block
 block discarded – undo
479 479
         if (empty($this->network_core_config->site_license_key)) {
480 480
             return false;
481 481
         }
482
-        $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
482
+        $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
483 483
         $verify_fail = get_option($ver_option_key, false);
484 484
         return $verify_fail === false
485
-                  || (! empty($this->network_core_config->site_license_key)
485
+                  || ( ! empty($this->network_core_config->site_license_key)
486 486
                         && $verify_fail === false
487 487
                   );
488 488
     }
@@ -528,6 +528,6 @@  discard block
 block discarded – undo
528 528
     private function getValidationIndicator()
529 529
     {
530 530
         $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
531
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
531
+        return '<span class="dashicons dashicons-admin-network '.$verified_class.' ee-icon-size-20"></span>';
532 532
     }
533 533
 }
Please login to merge, or discard this patch.
Indentation   +506 added lines, -506 removed lines patch added patch discarded remove patch
@@ -44,531 +44,531 @@
 block discarded – undo
44 44
 class OrganizationSettings extends FormHandler
45 45
 {
46 46
 
47
-    /**
48
-     * @var EE_Organization_Config
49
-     */
50
-    protected $organization_config;
47
+	/**
48
+	 * @var EE_Organization_Config
49
+	 */
50
+	protected $organization_config;
51 51
 
52
-    /**
53
-     * @var EE_Core_Config
54
-     */
55
-    protected $core_config;
52
+	/**
53
+	 * @var EE_Core_Config
54
+	 */
55
+	protected $core_config;
56 56
 
57 57
 
58
-    /**
59
-     * @var EE_Network_Core_Config
60
-     */
61
-    protected $network_core_config;
58
+	/**
59
+	 * @var EE_Network_Core_Config
60
+	 */
61
+	protected $network_core_config;
62 62
 
63
-    /**
64
-     * @var CountrySubRegionDao $countrySubRegionDao
65
-     */
66
-    protected $countrySubRegionDao;
63
+	/**
64
+	 * @var CountrySubRegionDao $countrySubRegionDao
65
+	 */
66
+	protected $countrySubRegionDao;
67 67
 
68
-    /**
69
-     * Form constructor.
70
-     *
71
-     * @param EE_Registry             $registry
72
-     * @param EE_Organization_Config  $organization_config
73
-     * @param EE_Core_Config          $core_config
74
-     * @param EE_Network_Core_Config $network_core_config
75
-     * @param CountrySubRegionDao $countrySubRegionDao
76
-     * @throws InvalidArgumentException
77
-     * @throws InvalidDataTypeException
78
-     * @throws DomainException
79
-     */
80
-    public function __construct(
81
-        EE_Registry $registry,
82
-        EE_Organization_Config $organization_config,
83
-        EE_Core_Config $core_config,
84
-        EE_Network_Core_Config $network_core_config,
85
-        CountrySubRegionDao $countrySubRegionDao
86
-    ) {
87
-        $this->organization_config = $organization_config;
88
-        $this->core_config = $core_config;
89
-        $this->network_core_config = $network_core_config;
90
-        $this->countrySubRegionDao = $countrySubRegionDao;
91
-        parent::__construct(
92
-            esc_html__('Your Organization Settings', 'event_espresso'),
93
-            esc_html__('Your Organization Settings', 'event_espresso'),
94
-            'organization_settings',
95
-            '',
96
-            FormHandler::DO_NOT_SETUP_FORM,
97
-            $registry
98
-        );
99
-    }
68
+	/**
69
+	 * Form constructor.
70
+	 *
71
+	 * @param EE_Registry             $registry
72
+	 * @param EE_Organization_Config  $organization_config
73
+	 * @param EE_Core_Config          $core_config
74
+	 * @param EE_Network_Core_Config $network_core_config
75
+	 * @param CountrySubRegionDao $countrySubRegionDao
76
+	 * @throws InvalidArgumentException
77
+	 * @throws InvalidDataTypeException
78
+	 * @throws DomainException
79
+	 */
80
+	public function __construct(
81
+		EE_Registry $registry,
82
+		EE_Organization_Config $organization_config,
83
+		EE_Core_Config $core_config,
84
+		EE_Network_Core_Config $network_core_config,
85
+		CountrySubRegionDao $countrySubRegionDao
86
+	) {
87
+		$this->organization_config = $organization_config;
88
+		$this->core_config = $core_config;
89
+		$this->network_core_config = $network_core_config;
90
+		$this->countrySubRegionDao = $countrySubRegionDao;
91
+		parent::__construct(
92
+			esc_html__('Your Organization Settings', 'event_espresso'),
93
+			esc_html__('Your Organization Settings', 'event_espresso'),
94
+			'organization_settings',
95
+			'',
96
+			FormHandler::DO_NOT_SETUP_FORM,
97
+			$registry
98
+		);
99
+	}
100 100
 
101 101
 
102
-    /**
103
-     * creates and returns the actual form
104
-     *
105
-     * @return EE_Form_Section_Proper
106
-     * @throws EE_Error
107
-     * @throws InvalidArgumentException
108
-     * @throws InvalidDataTypeException
109
-     * @throws InvalidInterfaceException
110
-     * @throws ReflectionException
111
-     */
112
-    public function generate()
113
-    {
114
-        $has_sub_regions = EEM_State::instance()->count(
115
-            array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
116
-        );
117
-        $form = new EE_Form_Section_Proper(
118
-            array(
119
-                'name'            => 'organization_settings',
120
-                'html_id'         => 'organization_settings',
121
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
122
-                'subsections'     => array(
123
-                    'contact_information_hdr'        => new EE_Form_Section_HTML(
124
-                        EEH_HTML::h2(
125
-                            esc_html__('Contact Information', 'event_espresso')
126
-                            . ' '
127
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
128
-                            '',
129
-                            'contact-information-hdr'
130
-                        )
131
-                    ),
132
-                    'organization_name'      => new EE_Text_Input(
133
-                        array(
134
-                            'html_name' => 'organization_name',
135
-                            'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
136
-                            'html_help_text'  => esc_html__(
137
-                                'Displayed on all emails and invoices.',
138
-                                'event_espresso'
139
-                            ),
140
-                            'default'         => $this->organization_config->get_pretty('name'),
141
-                            'required'        => false,
142
-                        )
143
-                    ),
144
-                    'organization_address_1'      => new EE_Text_Input(
145
-                        array(
146
-                            'html_name' => 'organization_address_1',
147
-                            'html_label_text' => esc_html__('Street Address', 'event_espresso'),
148
-                            'default'         => $this->organization_config->get_pretty('address_1'),
149
-                            'required'        => false,
150
-                        )
151
-                    ),
152
-                    'organization_address_2'      => new EE_Text_Input(
153
-                        array(
154
-                            'html_name' => 'organization_address_2',
155
-                            'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
156
-                            'default'         => $this->organization_config->get_pretty('address_2'),
157
-                            'required'        => false,
158
-                        )
159
-                    ),
160
-                    'organization_city'      => new EE_Text_Input(
161
-                        array(
162
-                            'html_name' => 'organization_city',
163
-                            'html_label_text' => esc_html__('City', 'event_espresso'),
164
-                            'default'         => $this->organization_config->get_pretty('city'),
165
-                            'required'        => false,
166
-                        )
167
-                    ),
168
-                    'organization_country'      => new EE_Country_Select_Input(
169
-                        null,
170
-                        array(
171
-                            EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
172
-                            'html_name'       => 'organization_country',
173
-                            'html_label_text' => esc_html__('Country', 'event_espresso'),
174
-                            'default'         => $this->organization_config->CNT_ISO,
175
-                            'required'        => false,
176
-                            'html_help_text'  => sprintf(
177
-                                esc_html__(
178
-                                    '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
179
-                                    'event_espresso'
180
-                                ),
181
-                                '<span class="reminder-spn">',
182
-                                '</span>'
183
-                            ),
184
-                        )
185
-                    ),
186
-                    'organization_state' => new EE_State_Select_Input(
187
-                        null,
188
-                        array(
189
-                            'html_name'       => 'organization_state',
190
-                            'html_label_text' => esc_html__('State/Province', 'event_espresso'),
191
-                            'default'         => $this->organization_config->STA_ID,
192
-                            'required'        => false,
193
-                            'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
194
-                                ? sprintf(
195
-                                    esc_html__(
196
-                                        'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s',
197
-                                        'event_espresso'
198
-                                    ),
199
-                                    '<span class="reminder-spn">',
200
-                                    '</span>',
201
-                                    '<br />'
202
-                                )
203
-                                : '',
204
-                        )
205
-                    ),
206
-                    'organization_zip'      => new EE_Text_Input(
207
-                        array(
208
-                            'html_name' => 'organization_zip',
209
-                            'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
210
-                            'default'         => $this->organization_config->get_pretty('zip'),
211
-                            'required'        => false,
212
-                        )
213
-                    ),
214
-                    'organization_email'      => new EE_Text_Input(
215
-                        array(
216
-                            'html_name' => 'organization_email',
217
-                            'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
218
-                            'html_help_text'  => sprintf(
219
-                                esc_html__(
220
-                                    'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
221
-                                    'event_espresso'
222
-                                ),
223
-                                '<code>[CO_FORMATTED_EMAIL]</code>',
224
-                                '<code>[CO_EMAIL]</code>'
225
-                            ),
226
-                            'default'         => $this->organization_config->get_pretty('email'),
227
-                            'required'        => false,
228
-                        )
229
-                    ),
230
-                    'organization_phone'      => new EE_Text_Input(
231
-                        array(
232
-                            'html_name' => 'organization_phone',
233
-                            'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
234
-                            'html_help_text'  => esc_html__(
235
-                                'The phone number for your organization.',
236
-                                'event_espresso'
237
-                            ),
238
-                            'default'         => $this->organization_config->get_pretty('phone'),
239
-                            'required'        => false,
240
-                        )
241
-                    ),
242
-                    'organization_vat'      => new EE_Text_Input(
243
-                        array(
244
-                            'html_name' => 'organization_vat',
245
-                            'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
246
-                            'html_help_text'  => esc_html__(
247
-                                'The VAT/Tax Number may be displayed on invoices and receipts.',
248
-                                'event_espresso'
249
-                            ),
250
-                            'default'         => $this->organization_config->get_pretty('vat'),
251
-                            'required'        => false,
252
-                        )
253
-                    ),
254
-                    'company_logo_hdr'        => new EE_Form_Section_HTML(
255
-                        EEH_HTML::h2(
256
-                            esc_html__('Company Logo', 'event_espresso')
257
-                            . ' '
258
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
259
-                            '',
260
-                            'company-logo-hdr'
261
-                        )
262
-                    ),
263
-                    'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
264
-                        array(
265
-                            'html_name' => 'organization_logo_url',
266
-                            'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
267
-                            'html_help_text'  => esc_html__(
268
-                                'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
269
-                                'event_espresso'
270
-                            ),
271
-                            'default'         => $this->organization_config->get_pretty('logo_url'),
272
-                            'required'        => false,
273
-                        )
274
-                    ),
275
-                    'social_links_hdr'        => new EE_Form_Section_HTML(
276
-                        EEH_HTML::h2(
277
-                            esc_html__('Social Links', 'event_espresso')
278
-                            . ' '
279
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
280
-                            . EEH_HTML::br()
281
-                            . EEH_HTML::p(
282
-                                esc_html__(
283
-                                    'Enter any links to social accounts for your organization here',
284
-                                    'event_espresso'
285
-                                ),
286
-                                '',
287
-                                'description'
288
-                            ),
289
-                            '',
290
-                            'social-links-hdr'
291
-                        )
292
-                    ),
293
-                    'organization_facebook'      => new EE_Text_Input(
294
-                        array(
295
-                            'html_name' => 'organization_facebook',
296
-                            'html_label_text' => esc_html__('Facebook', 'event_espresso'),
297
-                            'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
298
-                            'default'         => $this->organization_config->get_pretty('facebook'),
299
-                            'required'        => false,
300
-                        )
301
-                    ),
302
-                    'organization_twitter'      => new EE_Text_Input(
303
-                        array(
304
-                            'html_name' => 'organization_twitter',
305
-                            'html_label_text' => esc_html__('Twitter', 'event_espresso'),
306
-                            'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
307
-                            'default'         => $this->organization_config->get_pretty('twitter'),
308
-                            'required'        => false,
309
-                        )
310
-                    ),
311
-                    'organization_linkedin'      => new EE_Text_Input(
312
-                        array(
313
-                            'html_name' => 'organization_linkedin',
314
-                            'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
315
-                            'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
316
-                            'default'         => $this->organization_config->get_pretty('linkedin'),
317
-                            'required'        => false,
318
-                        )
319
-                    ),
320
-                    'organization_pinterest'      => new EE_Text_Input(
321
-                        array(
322
-                            'html_name' => 'organization_pinterest',
323
-                            'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
324
-                            'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
325
-                            'default'         => $this->organization_config->get_pretty('pinterest'),
326
-                            'required'        => false,
327
-                        )
328
-                    ),
329
-                    'organization_instagram'      => new EE_Text_Input(
330
-                        array(
331
-                            'html_name' => 'organization_instagram',
332
-                            'html_label_text' => esc_html__('Instagram', 'event_espresso'),
333
-                            'other_html_attributes' => ' placeholder="instagram.com/handle"',
334
-                            'default'         => $this->organization_config->get_pretty('instagram'),
335
-                            'required'        => false,
336
-                        )
337
-                    ),
338
-                ),
339
-            )
340
-        );
341
-        if (is_main_site()) {
342
-            $form->add_subsections(
343
-                array(
344
-                    'site_license_key_hdr' => new EE_Form_Section_HTML(
345
-                        EEH_HTML::h2(
346
-                            esc_html__('Your Event Espresso License Key', 'event_espresso')
347
-                            . ' '
348
-                            . EEH_HTML::span(
349
-                                EEH_Template::get_help_tab_link('site_license_key_info'),
350
-                                'help_tour_activation'
351
-                            ),
352
-                            '',
353
-                            'site-license-key-hdr'
354
-                        )
355
-                    ),
356
-                    'site_license_key' => $this->getSiteLicenseKeyField()
357
-                )
358
-            );
359
-            $form->add_subsections(
360
-                array(
361
-                    'uxip_optin_hdr' => new EE_Form_Section_HTML(
362
-                        $this->uxipOptinText()
363
-                    ),
364
-                    'ueip_optin' => new EE_Checkbox_Multi_Input(
365
-                        array(
366
-                            true => __('Yes! I want to help improve Event Espresso!', 'event_espresso')
367
-                        ),
368
-                        array(
369
-                            'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
370
-                            'html_label_text' => esc_html__(
371
-                                'UXIP Opt In?',
372
-                                'event_espresso'
373
-                            ),
374
-                            'default'         => isset($this->core_config->ee_ueip_optin)
375
-                                ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
376
-                                : false,
377
-                            'required'        => false,
378
-                        )
379
-                    ),
380
-                ),
381
-                'organization_instagram',
382
-                false
383
-            );
384
-        }
385
-        return $form;
386
-    }
102
+	/**
103
+	 * creates and returns the actual form
104
+	 *
105
+	 * @return EE_Form_Section_Proper
106
+	 * @throws EE_Error
107
+	 * @throws InvalidArgumentException
108
+	 * @throws InvalidDataTypeException
109
+	 * @throws InvalidInterfaceException
110
+	 * @throws ReflectionException
111
+	 */
112
+	public function generate()
113
+	{
114
+		$has_sub_regions = EEM_State::instance()->count(
115
+			array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
116
+		);
117
+		$form = new EE_Form_Section_Proper(
118
+			array(
119
+				'name'            => 'organization_settings',
120
+				'html_id'         => 'organization_settings',
121
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
122
+				'subsections'     => array(
123
+					'contact_information_hdr'        => new EE_Form_Section_HTML(
124
+						EEH_HTML::h2(
125
+							esc_html__('Contact Information', 'event_espresso')
126
+							. ' '
127
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
128
+							'',
129
+							'contact-information-hdr'
130
+						)
131
+					),
132
+					'organization_name'      => new EE_Text_Input(
133
+						array(
134
+							'html_name' => 'organization_name',
135
+							'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
136
+							'html_help_text'  => esc_html__(
137
+								'Displayed on all emails and invoices.',
138
+								'event_espresso'
139
+							),
140
+							'default'         => $this->organization_config->get_pretty('name'),
141
+							'required'        => false,
142
+						)
143
+					),
144
+					'organization_address_1'      => new EE_Text_Input(
145
+						array(
146
+							'html_name' => 'organization_address_1',
147
+							'html_label_text' => esc_html__('Street Address', 'event_espresso'),
148
+							'default'         => $this->organization_config->get_pretty('address_1'),
149
+							'required'        => false,
150
+						)
151
+					),
152
+					'organization_address_2'      => new EE_Text_Input(
153
+						array(
154
+							'html_name' => 'organization_address_2',
155
+							'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
156
+							'default'         => $this->organization_config->get_pretty('address_2'),
157
+							'required'        => false,
158
+						)
159
+					),
160
+					'organization_city'      => new EE_Text_Input(
161
+						array(
162
+							'html_name' => 'organization_city',
163
+							'html_label_text' => esc_html__('City', 'event_espresso'),
164
+							'default'         => $this->organization_config->get_pretty('city'),
165
+							'required'        => false,
166
+						)
167
+					),
168
+					'organization_country'      => new EE_Country_Select_Input(
169
+						null,
170
+						array(
171
+							EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
172
+							'html_name'       => 'organization_country',
173
+							'html_label_text' => esc_html__('Country', 'event_espresso'),
174
+							'default'         => $this->organization_config->CNT_ISO,
175
+							'required'        => false,
176
+							'html_help_text'  => sprintf(
177
+								esc_html__(
178
+									'%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
179
+									'event_espresso'
180
+								),
181
+								'<span class="reminder-spn">',
182
+								'</span>'
183
+							),
184
+						)
185
+					),
186
+					'organization_state' => new EE_State_Select_Input(
187
+						null,
188
+						array(
189
+							'html_name'       => 'organization_state',
190
+							'html_label_text' => esc_html__('State/Province', 'event_espresso'),
191
+							'default'         => $this->organization_config->STA_ID,
192
+							'required'        => false,
193
+							'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
194
+								? sprintf(
195
+									esc_html__(
196
+										'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s',
197
+										'event_espresso'
198
+									),
199
+									'<span class="reminder-spn">',
200
+									'</span>',
201
+									'<br />'
202
+								)
203
+								: '',
204
+						)
205
+					),
206
+					'organization_zip'      => new EE_Text_Input(
207
+						array(
208
+							'html_name' => 'organization_zip',
209
+							'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
210
+							'default'         => $this->organization_config->get_pretty('zip'),
211
+							'required'        => false,
212
+						)
213
+					),
214
+					'organization_email'      => new EE_Text_Input(
215
+						array(
216
+							'html_name' => 'organization_email',
217
+							'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
218
+							'html_help_text'  => sprintf(
219
+								esc_html__(
220
+									'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
221
+									'event_espresso'
222
+								),
223
+								'<code>[CO_FORMATTED_EMAIL]</code>',
224
+								'<code>[CO_EMAIL]</code>'
225
+							),
226
+							'default'         => $this->organization_config->get_pretty('email'),
227
+							'required'        => false,
228
+						)
229
+					),
230
+					'organization_phone'      => new EE_Text_Input(
231
+						array(
232
+							'html_name' => 'organization_phone',
233
+							'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
234
+							'html_help_text'  => esc_html__(
235
+								'The phone number for your organization.',
236
+								'event_espresso'
237
+							),
238
+							'default'         => $this->organization_config->get_pretty('phone'),
239
+							'required'        => false,
240
+						)
241
+					),
242
+					'organization_vat'      => new EE_Text_Input(
243
+						array(
244
+							'html_name' => 'organization_vat',
245
+							'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
246
+							'html_help_text'  => esc_html__(
247
+								'The VAT/Tax Number may be displayed on invoices and receipts.',
248
+								'event_espresso'
249
+							),
250
+							'default'         => $this->organization_config->get_pretty('vat'),
251
+							'required'        => false,
252
+						)
253
+					),
254
+					'company_logo_hdr'        => new EE_Form_Section_HTML(
255
+						EEH_HTML::h2(
256
+							esc_html__('Company Logo', 'event_espresso')
257
+							. ' '
258
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
259
+							'',
260
+							'company-logo-hdr'
261
+						)
262
+					),
263
+					'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
264
+						array(
265
+							'html_name' => 'organization_logo_url',
266
+							'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
267
+							'html_help_text'  => esc_html__(
268
+								'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
269
+								'event_espresso'
270
+							),
271
+							'default'         => $this->organization_config->get_pretty('logo_url'),
272
+							'required'        => false,
273
+						)
274
+					),
275
+					'social_links_hdr'        => new EE_Form_Section_HTML(
276
+						EEH_HTML::h2(
277
+							esc_html__('Social Links', 'event_espresso')
278
+							. ' '
279
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
280
+							. EEH_HTML::br()
281
+							. EEH_HTML::p(
282
+								esc_html__(
283
+									'Enter any links to social accounts for your organization here',
284
+									'event_espresso'
285
+								),
286
+								'',
287
+								'description'
288
+							),
289
+							'',
290
+							'social-links-hdr'
291
+						)
292
+					),
293
+					'organization_facebook'      => new EE_Text_Input(
294
+						array(
295
+							'html_name' => 'organization_facebook',
296
+							'html_label_text' => esc_html__('Facebook', 'event_espresso'),
297
+							'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
298
+							'default'         => $this->organization_config->get_pretty('facebook'),
299
+							'required'        => false,
300
+						)
301
+					),
302
+					'organization_twitter'      => new EE_Text_Input(
303
+						array(
304
+							'html_name' => 'organization_twitter',
305
+							'html_label_text' => esc_html__('Twitter', 'event_espresso'),
306
+							'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
307
+							'default'         => $this->organization_config->get_pretty('twitter'),
308
+							'required'        => false,
309
+						)
310
+					),
311
+					'organization_linkedin'      => new EE_Text_Input(
312
+						array(
313
+							'html_name' => 'organization_linkedin',
314
+							'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
315
+							'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
316
+							'default'         => $this->organization_config->get_pretty('linkedin'),
317
+							'required'        => false,
318
+						)
319
+					),
320
+					'organization_pinterest'      => new EE_Text_Input(
321
+						array(
322
+							'html_name' => 'organization_pinterest',
323
+							'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
324
+							'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
325
+							'default'         => $this->organization_config->get_pretty('pinterest'),
326
+							'required'        => false,
327
+						)
328
+					),
329
+					'organization_instagram'      => new EE_Text_Input(
330
+						array(
331
+							'html_name' => 'organization_instagram',
332
+							'html_label_text' => esc_html__('Instagram', 'event_espresso'),
333
+							'other_html_attributes' => ' placeholder="instagram.com/handle"',
334
+							'default'         => $this->organization_config->get_pretty('instagram'),
335
+							'required'        => false,
336
+						)
337
+					),
338
+				),
339
+			)
340
+		);
341
+		if (is_main_site()) {
342
+			$form->add_subsections(
343
+				array(
344
+					'site_license_key_hdr' => new EE_Form_Section_HTML(
345
+						EEH_HTML::h2(
346
+							esc_html__('Your Event Espresso License Key', 'event_espresso')
347
+							. ' '
348
+							. EEH_HTML::span(
349
+								EEH_Template::get_help_tab_link('site_license_key_info'),
350
+								'help_tour_activation'
351
+							),
352
+							'',
353
+							'site-license-key-hdr'
354
+						)
355
+					),
356
+					'site_license_key' => $this->getSiteLicenseKeyField()
357
+				)
358
+			);
359
+			$form->add_subsections(
360
+				array(
361
+					'uxip_optin_hdr' => new EE_Form_Section_HTML(
362
+						$this->uxipOptinText()
363
+					),
364
+					'ueip_optin' => new EE_Checkbox_Multi_Input(
365
+						array(
366
+							true => __('Yes! I want to help improve Event Espresso!', 'event_espresso')
367
+						),
368
+						array(
369
+							'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
370
+							'html_label_text' => esc_html__(
371
+								'UXIP Opt In?',
372
+								'event_espresso'
373
+							),
374
+							'default'         => isset($this->core_config->ee_ueip_optin)
375
+								? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
376
+								: false,
377
+							'required'        => false,
378
+						)
379
+					),
380
+				),
381
+				'organization_instagram',
382
+				false
383
+			);
384
+		}
385
+		return $form;
386
+	}
387 387
 
388 388
 
389
-    /**
390
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
391
-     * returns a string of HTML that can be directly echoed in a template
392
-     *
393
-     * @return string
394
-     * @throws EE_Error
395
-     * @throws InvalidArgumentException
396
-     * @throws InvalidDataTypeException
397
-     * @throws InvalidInterfaceException
398
-     * @throws LogicException
399
-     */
400
-    public function display()
401
-    {
402
-        $this->form()->enqueue_js();
403
-        return parent::display();
404
-    }
389
+	/**
390
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
391
+	 * returns a string of HTML that can be directly echoed in a template
392
+	 *
393
+	 * @return string
394
+	 * @throws EE_Error
395
+	 * @throws InvalidArgumentException
396
+	 * @throws InvalidDataTypeException
397
+	 * @throws InvalidInterfaceException
398
+	 * @throws LogicException
399
+	 */
400
+	public function display()
401
+	{
402
+		$this->form()->enqueue_js();
403
+		return parent::display();
404
+	}
405 405
 
406 406
 
407
-    /**
408
-     * handles processing the form submission
409
-     * returns true or false depending on whether the form was processed successfully or not
410
-     *
411
-     * @param array $form_data
412
-     * @return bool
413
-     * @throws InvalidFormSubmissionException
414
-     * @throws EE_Error
415
-     * @throws LogicException
416
-     * @throws InvalidArgumentException
417
-     * @throws InvalidDataTypeException
418
-     * @throws ReflectionException
419
-     */
420
-    public function process($form_data = array())
421
-    {
422
-        // process form
423
-        $valid_data = (array) parent::process($form_data);
424
-        if (empty($valid_data)) {
425
-            return false;
426
-        }
407
+	/**
408
+	 * handles processing the form submission
409
+	 * returns true or false depending on whether the form was processed successfully or not
410
+	 *
411
+	 * @param array $form_data
412
+	 * @return bool
413
+	 * @throws InvalidFormSubmissionException
414
+	 * @throws EE_Error
415
+	 * @throws LogicException
416
+	 * @throws InvalidArgumentException
417
+	 * @throws InvalidDataTypeException
418
+	 * @throws ReflectionException
419
+	 */
420
+	public function process($form_data = array())
421
+	{
422
+		// process form
423
+		$valid_data = (array) parent::process($form_data);
424
+		if (empty($valid_data)) {
425
+			return false;
426
+		}
427 427
 
428
-        if (is_main_site()) {
429
-            $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
430
-                ? sanitize_text_field($form_data['ee_site_license_key'])
431
-                : $this->network_core_config->site_license_key;
432
-        }
433
-        $this->organization_config->name = isset($form_data['organization_name'])
434
-            ? sanitize_text_field($form_data['organization_name'])
435
-            : $this->organization_config->name;
436
-        $this->organization_config->address_1 = isset($form_data['organization_address_1'])
437
-            ? sanitize_text_field($form_data['organization_address_1'])
438
-            : $this->organization_config->address_1;
439
-        $this->organization_config->address_2 = isset($form_data['organization_address_2'])
440
-            ? sanitize_text_field($form_data['organization_address_2'])
441
-            : $this->organization_config->address_2;
442
-        $this->organization_config->city = isset($form_data['organization_city'])
443
-            ? sanitize_text_field($form_data['organization_city'])
444
-            : $this->organization_config->city;
445
-        $this->organization_config->STA_ID = isset($form_data['organization_state'])
446
-            ? absint($form_data['organization_state'])
447
-            : $this->organization_config->STA_ID;
448
-        $this->organization_config->CNT_ISO = isset($form_data['organization_country'])
449
-            ? sanitize_text_field($form_data['organization_country'])
450
-            : $this->organization_config->CNT_ISO;
451
-        $this->organization_config->zip = isset($form_data['organization_zip'])
452
-            ? sanitize_text_field($form_data['organization_zip'])
453
-            : $this->organization_config->zip;
454
-        $this->organization_config->email = isset($form_data['organization_email'])
455
-            ? sanitize_email($form_data['organization_email'])
456
-            : $this->organization_config->email;
457
-        $this->organization_config->vat = isset($form_data['organization_vat'])
458
-            ? sanitize_text_field($form_data['organization_vat'])
459
-            : $this->organization_config->vat;
460
-        $this->organization_config->phone = isset($form_data['organization_phone'])
461
-            ? sanitize_text_field($form_data['organization_phone'])
462
-            : $this->organization_config->phone;
463
-        $this->organization_config->logo_url = isset($form_data['organization_logo_url'])
464
-            ? esc_url_raw($form_data['organization_logo_url'])
465
-            : $this->organization_config->logo_url;
466
-        $this->organization_config->facebook = isset($form_data['organization_facebook'])
467
-            ? esc_url_raw($form_data['organization_facebook'])
468
-            : $this->organization_config->facebook;
469
-        $this->organization_config->twitter = isset($form_data['organization_twitter'])
470
-            ? esc_url_raw($form_data['organization_twitter'])
471
-            : $this->organization_config->twitter;
472
-        $this->organization_config->linkedin = isset($form_data['organization_linkedin'])
473
-            ? esc_url_raw($form_data['organization_linkedin'])
474
-            : $this->organization_config->linkedin;
475
-        $this->organization_config->pinterest = isset($form_data['organization_pinterest'])
476
-            ? esc_url_raw($form_data['organization_pinterest'])
477
-            : $this->organization_config->pinterest;
478
-        $this->organization_config->google = isset($form_data['organization_google'])
479
-            ? esc_url_raw($form_data['organization_google'])
480
-            : $this->organization_config->google;
481
-        $this->organization_config->instagram = isset($form_data['organization_instagram'])
482
-            ? esc_url_raw($form_data['organization_instagram'])
483
-            : $this->organization_config->instagram;
484
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
485
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
486
-            : false;
487
-        $this->core_config->ee_ueip_has_notified = true;
428
+		if (is_main_site()) {
429
+			$this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
430
+				? sanitize_text_field($form_data['ee_site_license_key'])
431
+				: $this->network_core_config->site_license_key;
432
+		}
433
+		$this->organization_config->name = isset($form_data['organization_name'])
434
+			? sanitize_text_field($form_data['organization_name'])
435
+			: $this->organization_config->name;
436
+		$this->organization_config->address_1 = isset($form_data['organization_address_1'])
437
+			? sanitize_text_field($form_data['organization_address_1'])
438
+			: $this->organization_config->address_1;
439
+		$this->organization_config->address_2 = isset($form_data['organization_address_2'])
440
+			? sanitize_text_field($form_data['organization_address_2'])
441
+			: $this->organization_config->address_2;
442
+		$this->organization_config->city = isset($form_data['organization_city'])
443
+			? sanitize_text_field($form_data['organization_city'])
444
+			: $this->organization_config->city;
445
+		$this->organization_config->STA_ID = isset($form_data['organization_state'])
446
+			? absint($form_data['organization_state'])
447
+			: $this->organization_config->STA_ID;
448
+		$this->organization_config->CNT_ISO = isset($form_data['organization_country'])
449
+			? sanitize_text_field($form_data['organization_country'])
450
+			: $this->organization_config->CNT_ISO;
451
+		$this->organization_config->zip = isset($form_data['organization_zip'])
452
+			? sanitize_text_field($form_data['organization_zip'])
453
+			: $this->organization_config->zip;
454
+		$this->organization_config->email = isset($form_data['organization_email'])
455
+			? sanitize_email($form_data['organization_email'])
456
+			: $this->organization_config->email;
457
+		$this->organization_config->vat = isset($form_data['organization_vat'])
458
+			? sanitize_text_field($form_data['organization_vat'])
459
+			: $this->organization_config->vat;
460
+		$this->organization_config->phone = isset($form_data['organization_phone'])
461
+			? sanitize_text_field($form_data['organization_phone'])
462
+			: $this->organization_config->phone;
463
+		$this->organization_config->logo_url = isset($form_data['organization_logo_url'])
464
+			? esc_url_raw($form_data['organization_logo_url'])
465
+			: $this->organization_config->logo_url;
466
+		$this->organization_config->facebook = isset($form_data['organization_facebook'])
467
+			? esc_url_raw($form_data['organization_facebook'])
468
+			: $this->organization_config->facebook;
469
+		$this->organization_config->twitter = isset($form_data['organization_twitter'])
470
+			? esc_url_raw($form_data['organization_twitter'])
471
+			: $this->organization_config->twitter;
472
+		$this->organization_config->linkedin = isset($form_data['organization_linkedin'])
473
+			? esc_url_raw($form_data['organization_linkedin'])
474
+			: $this->organization_config->linkedin;
475
+		$this->organization_config->pinterest = isset($form_data['organization_pinterest'])
476
+			? esc_url_raw($form_data['organization_pinterest'])
477
+			: $this->organization_config->pinterest;
478
+		$this->organization_config->google = isset($form_data['organization_google'])
479
+			? esc_url_raw($form_data['organization_google'])
480
+			: $this->organization_config->google;
481
+		$this->organization_config->instagram = isset($form_data['organization_instagram'])
482
+			? esc_url_raw($form_data['organization_instagram'])
483
+			: $this->organization_config->instagram;
484
+		$this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
485
+			? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
486
+			: false;
487
+		$this->core_config->ee_ueip_has_notified = true;
488 488
 
489
-        $this->registry->CFG->currency = new EE_Currency_Config(
490
-            $this->organization_config->CNT_ISO
491
-        );
492
-        /** @var EE_Country $country */
493
-        $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
494
-        if ($country instanceof EE_Country) {
495
-            $country->set('CNT_active', 1);
496
-            $country->save();
497
-            $this->countrySubRegionDao->saveCountrySubRegions($country);
498
-        }
499
-        return true;
500
-    }
489
+		$this->registry->CFG->currency = new EE_Currency_Config(
490
+			$this->organization_config->CNT_ISO
491
+		);
492
+		/** @var EE_Country $country */
493
+		$country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
494
+		if ($country instanceof EE_Country) {
495
+			$country->set('CNT_active', 1);
496
+			$country->save();
497
+			$this->countrySubRegionDao->saveCountrySubRegions($country);
498
+		}
499
+		return true;
500
+	}
501 501
 
502 502
 
503
-    /**
504
-     * @return string
505
-     */
506
-    private function uxipOptinText()
507
-    {
508
-        ob_start();
509
-        Stats::optinText(false);
510
-        return ob_get_clean();
511
-    }
503
+	/**
504
+	 * @return string
505
+	 */
506
+	private function uxipOptinText()
507
+	{
508
+		ob_start();
509
+		Stats::optinText(false);
510
+		return ob_get_clean();
511
+	}
512 512
 
513 513
 
514
-    /**
515
-     * Return whether the site license key has been verified or not.
516
-     * @return bool
517
-     */
518
-    private function licenseKeyVerified()
519
-    {
520
-        if (empty($this->network_core_config->site_license_key)) {
521
-            return false;
522
-        }
523
-        $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
524
-        $verify_fail = get_option($ver_option_key, false);
525
-        return $verify_fail === false
526
-                  || (! empty($this->network_core_config->site_license_key)
527
-                        && $verify_fail === false
528
-                  );
529
-    }
514
+	/**
515
+	 * Return whether the site license key has been verified or not.
516
+	 * @return bool
517
+	 */
518
+	private function licenseKeyVerified()
519
+	{
520
+		if (empty($this->network_core_config->site_license_key)) {
521
+			return false;
522
+		}
523
+		$ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
524
+		$verify_fail = get_option($ver_option_key, false);
525
+		return $verify_fail === false
526
+				  || (! empty($this->network_core_config->site_license_key)
527
+						&& $verify_fail === false
528
+				  );
529
+	}
530 530
 
531 531
 
532
-    /**
533
-     * @return EE_Text_Input
534
-     */
535
-    private function getSiteLicenseKeyField()
536
-    {
537
-        $text_input = new EE_Text_Input(
538
-            array(
539
-                'html_name' => 'ee_site_license_key',
540
-                'html_id' => 'site_license_key',
541
-                'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
542
-                /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
543
-                'html_help_text'  => sprintf(
544
-                    esc_html__(
545
-                        'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
546
-                        'event_espresso'
547
-                    ),
548
-                    '<strong>',
549
-                    '</strong>'
550
-                ),
551
-                /** phpcs:enable */
552
-                'default'         => isset($this->network_core_config->site_license_key)
553
-                    ? $this->network_core_config->site_license_key
554
-                    : '',
555
-                'required'        => false,
556
-                'form_html_filter' => new VsprintfFilter(
557
-                    '%2$s %1$s',
558
-                    array($this->getValidationIndicator())
559
-                )
560
-            )
561
-        );
562
-        return $text_input;
563
-    }
532
+	/**
533
+	 * @return EE_Text_Input
534
+	 */
535
+	private function getSiteLicenseKeyField()
536
+	{
537
+		$text_input = new EE_Text_Input(
538
+			array(
539
+				'html_name' => 'ee_site_license_key',
540
+				'html_id' => 'site_license_key',
541
+				'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
542
+				/** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
543
+				'html_help_text'  => sprintf(
544
+					esc_html__(
545
+						'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
546
+						'event_espresso'
547
+					),
548
+					'<strong>',
549
+					'</strong>'
550
+				),
551
+				/** phpcs:enable */
552
+				'default'         => isset($this->network_core_config->site_license_key)
553
+					? $this->network_core_config->site_license_key
554
+					: '',
555
+				'required'        => false,
556
+				'form_html_filter' => new VsprintfFilter(
557
+					'%2$s %1$s',
558
+					array($this->getValidationIndicator())
559
+				)
560
+			)
561
+		);
562
+		return $text_input;
563
+	}
564 564
 
565 565
 
566
-    /**
567
-     * @return string
568
-     */
569
-    private function getValidationIndicator()
570
-    {
571
-        $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
572
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
573
-    }
566
+	/**
567
+	 * @return string
568
+	 */
569
+	private function getValidationIndicator()
570
+	{
571
+		$verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
572
+		return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
573
+	}
574 574
 }
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-header.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@
 block discarded – undo
5 5
 ?>
6 6
 <header class="event-header">
7 7
 	<?php echo "<{$tag}  id=\"event-details-{$tag}-{$post->ID}\" class=\"entry-title\">"; ?>
8
-		<a class="ee-event-header-lnk" href="<?php the_permalink(); ?>"<?php echo \EED_Events_Archive::link_target();?>>
8
+		<a class="ee-event-header-lnk" href="<?php the_permalink(); ?>"<?php echo \EED_Events_Archive::link_target(); ?>>
9 9
             <?php the_title(); ?>
10 10
         </a>
11 11
 	<?php echo "</{$tag}>"; ?>
12
-	<?php if ( ! is_archive() && has_excerpt( $post->ID )): the_excerpt(); endif;?>
12
+	<?php if ( ! is_archive() && has_excerpt($post->ID)): the_excerpt(); endif; ?>
13 13
 </header>
Please login to merge, or discard this patch.