Completed
Branch 973/fix-visible-recaptcha (0580c7)
by
unknown
03:03 queued 30s
created
core/services/assets/I18nRegistry.php 2 patches
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function registerScriptI18n($handle, $domain = 'event_espresso')
77 77
     {
78
-        if(! isset($this->registered_i18n[$handle])) {
79
-            $this->registered_i18n[ $handle ] = 1;
80
-            $this->queued_scripts[ $handle ] = $domain;
78
+        if ( ! isset($this->registered_i18n[$handle])) {
79
+            $this->registered_i18n[$handle] = 1;
80
+            $this->queued_scripts[$handle] = $domain;
81 81
         }
82 82
     }
83 83
 
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
     protected function registerInlineScript($handle, array $translations, $domain)
122 122
     {
123 123
         $script = $domain ?
124
-            'eejs.i18n.setLocaleData( ' . wp_json_encode($translations) . ', "' . $domain . '" );' :
125
-            'eejs.i18n.setLocaleData( ' . wp_json_encode($translations) . ' );';
124
+            'eejs.i18n.setLocaleData( '.wp_json_encode($translations).', "'.$domain.'" );' : 'eejs.i18n.setLocaleData( '.wp_json_encode($translations).' );';
126 125
         wp_add_inline_script($handle, $script, 'before');
127 126
     }
128 127
 
@@ -158,9 +157,9 @@  discard block
 block discarded – undo
158 157
     private function setI18nMap(array $i18n_map)
159 158
     {
160 159
         if (empty($i18n_map)) {
161
-            $i18n_map = file_exists($this->domain->pluginPath() . 'translation-map.json')
160
+            $i18n_map = file_exists($this->domain->pluginPath().'translation-map.json')
162 161
                 ? json_decode(
163
-                        file_get_contents($this->domain->pluginPath() . 'translation-map.json'),
162
+                        file_get_contents($this->domain->pluginPath().'translation-map.json'),
164 163
                         true
165 164
                     )
166 165
                 : array();
@@ -238,7 +237,7 @@  discard block
 block discarded – undo
238 237
             ),
239 238
         );
240 239
 
241
-        if (! empty($translations->headers['Plural-Forms'])) {
240
+        if ( ! empty($translations->headers['Plural-Forms'])) {
242 241
             $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
243 242
         }
244 243
 
Please login to merge, or discard this patch.
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -15,239 +15,239 @@
 block discarded – undo
15 15
  */
16 16
 class I18nRegistry
17 17
 {
18
-    /**
19
-     * @var DomainInterface
20
-     */
21
-    private $domain;
22
-
23
-    /**
24
-     * Will hold all registered i18n scripts.  Prevents script handles from being registered more than once.
25
-     *
26
-     * @var array
27
-     */
28
-    private $registered_i18n = array();
29
-
30
-
31
-    /**
32
-     * Used to hold queued translations for the chunks loading in a view.
33
-     *
34
-     * @var array
35
-     */
36
-    private $queued_handle_translations = array();
37
-
38
-    /**
39
-     * Used to track script handles queued for adding translation strings as inline data in the dom.
40
-     *
41
-     * @var array
42
-     */
43
-    private $queued_scripts = array();
44
-
45
-
46
-    /**
47
-     * Obtained from the generated json file from the all javascript using wp.i18n with a map of script handle names to
48
-     * translation strings.
49
-     *
50
-     * @var array
51
-     */
52
-    private $i18n_map;
53
-
54
-
55
-    /**
56
-     * I18nRegistry constructor.
57
-     *
58
-     * @param DomainInterface $domain
59
-     * @param array() $i18n_map  An array of script handle names and the strings translated for those handles.  If not
60
-     *                            provided, the class will look for map in root of plugin with filename of
61
-     *                            'translation-map.json'.
62
-     */
63
-    public function __construct(DomainInterface $domain, array $i18n_map = [])
64
-    {
65
-        $this->domain = $domain;
66
-        $this->setI18nMap($i18n_map);
67
-        add_filter('print_scripts_array', array($this, 'queueI18n'));
68
-    }
69
-
70
-
71
-    /**
72
-     * Used to register a script that has i18n strings for its $handle
73
-     *
74
-     * @param string $handle The script handle reference.
75
-     * @param string $domain The i18n domain for the strings.
76
-     */
77
-    public function registerScriptI18n($handle, $domain = 'event_espresso')
78
-    {
79
-        if(! isset($this->registered_i18n[$handle])) {
80
-            $this->registered_i18n[ $handle ] = 1;
81
-            $this->queued_scripts[ $handle ] = $domain;
82
-        }
83
-    }
84
-
85
-
86
-
87
-    /**
88
-     * Callback on print_scripts_array to listen for scripts enqueued and handle setting up the localized data.
89
-     *
90
-     * @param array $handles Array of registered script handles.
91
-     * @return array
92
-     */
93
-    public function queueI18n(array $handles)
94
-    {
95
-        if (empty($this->queued_scripts)) {
96
-            return $handles;
97
-        }
98
-        foreach ($handles as $handle) {
99
-            $this->queueI18nTranslationsForHandle($handle);
100
-        }
101
-        if ($this->queued_handle_translations) {
102
-            foreach ($this->queued_handle_translations as $handle => $translations_for_domain) {
103
-                $this->registerInlineScript(
104
-                    $handle,
105
-                    $translations_for_domain['translations'],
106
-                    $translations_for_domain['domain']
107
-                );
108
-                unset($this->queued_handle_translations[$handle]);
109
-            }
110
-        }
111
-        return $handles;
112
-    }
113
-
114
-
115
-    /**
116
-     * Registers inline script with translations for given handle and domain.
117
-     *
118
-     * @param string $handle       Handle used to register javascript file containing translations.
119
-     * @param array  $translations Array of string translations.
120
-     * @param string $domain       Domain for translations.  If left empty then strings are registered with the default
121
-     *                             domain for the javascript.
122
-     */
123
-    protected function registerInlineScript($handle, array $translations, $domain)
124
-    {
125
-        $script = $domain ?
126
-            'eejs.i18n.setLocaleData( ' . wp_json_encode($translations) . ', "' . $domain . '" );' :
127
-            'eejs.i18n.setLocaleData( ' . wp_json_encode($translations) . ' );';
128
-        wp_add_inline_script($handle, $script, 'before');
129
-    }
130
-
131
-
132
-    /**
133
-     * Queues up the translation strings for the given handle.
134
-     *
135
-     * @param string $handle The script handle being queued up.
136
-     */
137
-    private function queueI18nTranslationsForHandle($handle)
138
-    {
139
-        if (isset($this->queued_scripts[$handle])) {
140
-            $domain = $this->queued_scripts[$handle];
141
-            $translations = $this->getJedLocaleDataForDomainAndChunk($handle, $domain);
142
-            if (count($translations) > 0) {
143
-                $this->queued_handle_translations[$handle] = array(
144
-                    'domain'       => $domain,
145
-                    'translations' => $translations,
146
-                );
147
-            }
148
-            unset($this->queued_scripts[$handle]);
149
-        }
150
-    }
151
-
152
-
153
-    /**
154
-     * Sets the internal i18n_map property.
155
-     * If $chunk_map is empty or not an array, will attempt to load a chunk map from a default named map.
156
-     *
157
-     * @param array $i18n_map  If provided, an array of translation strings indexed by script handle names they
158
-     *                         correspond to.
159
-     */
160
-    private function setI18nMap(array $i18n_map)
161
-    {
162
-        if (empty($i18n_map)) {
163
-            $i18n_map = file_exists($this->domain->pluginPath() . 'translation-map.json')
164
-                ? json_decode(
165
-                        file_get_contents($this->domain->pluginPath() . 'translation-map.json'),
166
-                        true
167
-                    )
168
-                : array();
169
-        }
170
-        $this->i18n_map = $i18n_map;
171
-    }
172
-
173
-
174
-    /**
175
-     * Get the jed locale data for a given $handle and domain
176
-     *
177
-     * @param string $handle The name for the script handle we want strings returned for.
178
-     * @param string $domain The i18n domain.
179
-     * @return array
180
-     */
181
-    protected function getJedLocaleDataForDomainAndChunk($handle, $domain)
182
-    {
183
-        $translations = $this->getJedLocaleData($domain);
184
-        // get index for adding back after extracting strings for this $chunk.
185
-        $index = $translations[''];
186
-        $translations = $this->getLocaleDataMatchingMap(
187
-            $this->getOriginalStringsForHandleFromMap($handle),
188
-            $translations
189
-        );
190
-        $translations[''] = $index;
191
-        return $translations;
192
-    }
193
-
194
-
195
-    /**
196
-     * Get locale data for given strings from given translations
197
-     *
198
-     * @param array $string_set   This is the subset of strings (msgIds) we want to extract from the translations array.
199
-     * @param array $translations Translation data to extra strings from.
200
-     * @return array
201
-     */
202
-    protected function getLocaleDataMatchingMap(array $string_set, array $translations)
203
-    {
204
-        if (empty($string_set)) {
205
-            return array();
206
-        }
207
-        // some strings with quotes in them will break on the array_flip, so making sure quotes in the string are
208
-        // slashed also filter falsey values.
209
-        $string_set = array_unique(array_filter(wp_slash($string_set)));
210
-        return array_intersect_key($translations, array_flip($string_set));
211
-    }
212
-
213
-
214
-    /**
215
-     * Get original strings to translate for the given chunk from the map
216
-     *
217
-     * @param string $handle The script handle name to get strings from the map for.
218
-     * @return array
219
-     */
220
-    protected function getOriginalStringsForHandleFromMap($handle)
221
-    {
222
-        return isset($this->i18n_map[$handle]) ? $this->i18n_map[$handle] : array();
223
-    }
224
-
225
-
226
-    /**
227
-     * Returns Jed-formatted localization data.
228
-     *
229
-     * @param  string $domain Translation domain.
230
-     * @return array
231
-     */
232
-    private function getJedLocaleData($domain)
233
-    {
234
-        $translations = get_translations_for_domain($domain);
235
-
236
-        $locale = array(
237
-            '' => array(
238
-                'domain' => $domain,
239
-                'lang'   => is_admin() ? EEH_DTT_Helper::get_user_locale() : get_locale()
240
-            ),
241
-        );
242
-
243
-        if (! empty($translations->headers['Plural-Forms'])) {
244
-            $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
245
-        }
246
-
247
-        foreach ($translations->entries as $msgid => $entry) {
248
-            $locale[$msgid] = $entry->translations;
249
-        }
250
-
251
-        return $locale;
252
-    }
18
+	/**
19
+	 * @var DomainInterface
20
+	 */
21
+	private $domain;
22
+
23
+	/**
24
+	 * Will hold all registered i18n scripts.  Prevents script handles from being registered more than once.
25
+	 *
26
+	 * @var array
27
+	 */
28
+	private $registered_i18n = array();
29
+
30
+
31
+	/**
32
+	 * Used to hold queued translations for the chunks loading in a view.
33
+	 *
34
+	 * @var array
35
+	 */
36
+	private $queued_handle_translations = array();
37
+
38
+	/**
39
+	 * Used to track script handles queued for adding translation strings as inline data in the dom.
40
+	 *
41
+	 * @var array
42
+	 */
43
+	private $queued_scripts = array();
44
+
45
+
46
+	/**
47
+	 * Obtained from the generated json file from the all javascript using wp.i18n with a map of script handle names to
48
+	 * translation strings.
49
+	 *
50
+	 * @var array
51
+	 */
52
+	private $i18n_map;
53
+
54
+
55
+	/**
56
+	 * I18nRegistry constructor.
57
+	 *
58
+	 * @param DomainInterface $domain
59
+	 * @param array() $i18n_map  An array of script handle names and the strings translated for those handles.  If not
60
+	 *                            provided, the class will look for map in root of plugin with filename of
61
+	 *                            'translation-map.json'.
62
+	 */
63
+	public function __construct(DomainInterface $domain, array $i18n_map = [])
64
+	{
65
+		$this->domain = $domain;
66
+		$this->setI18nMap($i18n_map);
67
+		add_filter('print_scripts_array', array($this, 'queueI18n'));
68
+	}
69
+
70
+
71
+	/**
72
+	 * Used to register a script that has i18n strings for its $handle
73
+	 *
74
+	 * @param string $handle The script handle reference.
75
+	 * @param string $domain The i18n domain for the strings.
76
+	 */
77
+	public function registerScriptI18n($handle, $domain = 'event_espresso')
78
+	{
79
+		if(! isset($this->registered_i18n[$handle])) {
80
+			$this->registered_i18n[ $handle ] = 1;
81
+			$this->queued_scripts[ $handle ] = $domain;
82
+		}
83
+	}
84
+
85
+
86
+
87
+	/**
88
+	 * Callback on print_scripts_array to listen for scripts enqueued and handle setting up the localized data.
89
+	 *
90
+	 * @param array $handles Array of registered script handles.
91
+	 * @return array
92
+	 */
93
+	public function queueI18n(array $handles)
94
+	{
95
+		if (empty($this->queued_scripts)) {
96
+			return $handles;
97
+		}
98
+		foreach ($handles as $handle) {
99
+			$this->queueI18nTranslationsForHandle($handle);
100
+		}
101
+		if ($this->queued_handle_translations) {
102
+			foreach ($this->queued_handle_translations as $handle => $translations_for_domain) {
103
+				$this->registerInlineScript(
104
+					$handle,
105
+					$translations_for_domain['translations'],
106
+					$translations_for_domain['domain']
107
+				);
108
+				unset($this->queued_handle_translations[$handle]);
109
+			}
110
+		}
111
+		return $handles;
112
+	}
113
+
114
+
115
+	/**
116
+	 * Registers inline script with translations for given handle and domain.
117
+	 *
118
+	 * @param string $handle       Handle used to register javascript file containing translations.
119
+	 * @param array  $translations Array of string translations.
120
+	 * @param string $domain       Domain for translations.  If left empty then strings are registered with the default
121
+	 *                             domain for the javascript.
122
+	 */
123
+	protected function registerInlineScript($handle, array $translations, $domain)
124
+	{
125
+		$script = $domain ?
126
+			'eejs.i18n.setLocaleData( ' . wp_json_encode($translations) . ', "' . $domain . '" );' :
127
+			'eejs.i18n.setLocaleData( ' . wp_json_encode($translations) . ' );';
128
+		wp_add_inline_script($handle, $script, 'before');
129
+	}
130
+
131
+
132
+	/**
133
+	 * Queues up the translation strings for the given handle.
134
+	 *
135
+	 * @param string $handle The script handle being queued up.
136
+	 */
137
+	private function queueI18nTranslationsForHandle($handle)
138
+	{
139
+		if (isset($this->queued_scripts[$handle])) {
140
+			$domain = $this->queued_scripts[$handle];
141
+			$translations = $this->getJedLocaleDataForDomainAndChunk($handle, $domain);
142
+			if (count($translations) > 0) {
143
+				$this->queued_handle_translations[$handle] = array(
144
+					'domain'       => $domain,
145
+					'translations' => $translations,
146
+				);
147
+			}
148
+			unset($this->queued_scripts[$handle]);
149
+		}
150
+	}
151
+
152
+
153
+	/**
154
+	 * Sets the internal i18n_map property.
155
+	 * If $chunk_map is empty or not an array, will attempt to load a chunk map from a default named map.
156
+	 *
157
+	 * @param array $i18n_map  If provided, an array of translation strings indexed by script handle names they
158
+	 *                         correspond to.
159
+	 */
160
+	private function setI18nMap(array $i18n_map)
161
+	{
162
+		if (empty($i18n_map)) {
163
+			$i18n_map = file_exists($this->domain->pluginPath() . 'translation-map.json')
164
+				? json_decode(
165
+						file_get_contents($this->domain->pluginPath() . 'translation-map.json'),
166
+						true
167
+					)
168
+				: array();
169
+		}
170
+		$this->i18n_map = $i18n_map;
171
+	}
172
+
173
+
174
+	/**
175
+	 * Get the jed locale data for a given $handle and domain
176
+	 *
177
+	 * @param string $handle The name for the script handle we want strings returned for.
178
+	 * @param string $domain The i18n domain.
179
+	 * @return array
180
+	 */
181
+	protected function getJedLocaleDataForDomainAndChunk($handle, $domain)
182
+	{
183
+		$translations = $this->getJedLocaleData($domain);
184
+		// get index for adding back after extracting strings for this $chunk.
185
+		$index = $translations[''];
186
+		$translations = $this->getLocaleDataMatchingMap(
187
+			$this->getOriginalStringsForHandleFromMap($handle),
188
+			$translations
189
+		);
190
+		$translations[''] = $index;
191
+		return $translations;
192
+	}
193
+
194
+
195
+	/**
196
+	 * Get locale data for given strings from given translations
197
+	 *
198
+	 * @param array $string_set   This is the subset of strings (msgIds) we want to extract from the translations array.
199
+	 * @param array $translations Translation data to extra strings from.
200
+	 * @return array
201
+	 */
202
+	protected function getLocaleDataMatchingMap(array $string_set, array $translations)
203
+	{
204
+		if (empty($string_set)) {
205
+			return array();
206
+		}
207
+		// some strings with quotes in them will break on the array_flip, so making sure quotes in the string are
208
+		// slashed also filter falsey values.
209
+		$string_set = array_unique(array_filter(wp_slash($string_set)));
210
+		return array_intersect_key($translations, array_flip($string_set));
211
+	}
212
+
213
+
214
+	/**
215
+	 * Get original strings to translate for the given chunk from the map
216
+	 *
217
+	 * @param string $handle The script handle name to get strings from the map for.
218
+	 * @return array
219
+	 */
220
+	protected function getOriginalStringsForHandleFromMap($handle)
221
+	{
222
+		return isset($this->i18n_map[$handle]) ? $this->i18n_map[$handle] : array();
223
+	}
224
+
225
+
226
+	/**
227
+	 * Returns Jed-formatted localization data.
228
+	 *
229
+	 * @param  string $domain Translation domain.
230
+	 * @return array
231
+	 */
232
+	private function getJedLocaleData($domain)
233
+	{
234
+		$translations = get_translations_for_domain($domain);
235
+
236
+		$locale = array(
237
+			'' => array(
238
+				'domain' => $domain,
239
+				'lang'   => is_admin() ? EEH_DTT_Helper::get_user_locale() : get_locale()
240
+			),
241
+		);
242
+
243
+		if (! empty($translations->headers['Plural-Forms'])) {
244
+			$locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
245
+		}
246
+
247
+		foreach ($translations->entries as $msgid => $entry) {
248
+			$locale[$msgid] = $entry->translations;
249
+		}
250
+
251
+		return $locale;
252
+	}
253 253
 }
254 254
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/request/middleware/RecommendedVersions.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
         $this->request = $request;
33 33
         $this->response = $response;
34 34
         // check required WP version
35
-        if (! $this->minimumWordPressVersionRequired()) {
35
+        if ( ! $this->minimumWordPressVersionRequired()) {
36 36
             $this->request->unSetRequestParam('activate', true);
37 37
             add_action('admin_notices', array($this, 'minimumWpVersionError'), 1);
38 38
             $this->response->terminateRequest();
39 39
             $this->response->deactivatePlugin();
40 40
         }
41 41
         // check recommended PHP version
42
-        if (! $this->minimumPhpVersionRecommended()) {
42
+        if ( ! $this->minimumPhpVersionRecommended()) {
43 43
             $this->displayMinimumRecommendedPhpVersionNotice();
44 44
         }
45 45
         // upcoming required version
46
-        if (! $this->upcomingRequiredPhpVersion()) {
46
+        if ( ! $this->upcomingRequiredPhpVersion()) {
47 47
             $this->displayUpcomingRequiredVersion();
48 48
         }
49 49
         $this->response = $this->processRequestStack($this->request, $this->response);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         if ($this->request->isAdmin()) {
144 144
             new PersistentAdminNotice(
145
-                'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended',
145
+                'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended',
146 146
                 sprintf(
147 147
                     esc_html__(
148 148
                         'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request)
181 181
             && current_user_can('update_plugins')
182 182
         ) {
183
-            add_action('admin_notices', function () {
183
+            add_action('admin_notices', function() {
184 184
                 echo '<div class="notice event-espresso-admin-notice notice-warning"><p>'
185 185
                      . sprintf(
186 186
                          esc_html__(
Please login to merge, or discard this patch.
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -19,183 +19,183 @@
 block discarded – undo
19 19
 class RecommendedVersions extends Middleware
20 20
 {
21 21
 
22
-    /**
23
-     * converts a Request to a Response
24
-     *
25
-     * @param RequestInterface  $request
26
-     * @param ResponseInterface $response
27
-     * @return ResponseInterface
28
-     * @throws InvalidDataTypeException
29
-     */
30
-    public function handleRequest(RequestInterface $request, ResponseInterface $response)
31
-    {
32
-        $this->request = $request;
33
-        $this->response = $response;
34
-        // check required WP version
35
-        if (! $this->minimumWordPressVersionRequired()) {
36
-            $this->request->unSetRequestParam('activate', true);
37
-            add_action('admin_notices', array($this, 'minimumWpVersionError'), 1);
38
-            $this->response->terminateRequest();
39
-            $this->response->deactivatePlugin();
40
-        }
41
-        // check recommended PHP version
42
-        if (! $this->minimumPhpVersionRecommended()) {
43
-            $this->displayMinimumRecommendedPhpVersionNotice();
44
-        }
45
-        // upcoming required version
46
-        if (! $this->upcomingRequiredPhpVersion()) {
47
-            $this->displayUpcomingRequiredVersion();
48
-        }
49
-        $this->response = $this->processRequestStack($this->request, $this->response);
50
-        return $this->response;
51
-    }
52
-
53
-
54
-    /**
55
-     * Helper method to assess installed wp version against given values.
56
-     * By default this compares the required minimum version of WP for EE against the installed version of WP
57
-     * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked
58
-     * against) so consider that when sending in your values.
59
-     *
60
-     * @param string $version_to_check
61
-     * @param string $operator
62
-     * @return bool
63
-     */
64
-    public static function compareWordPressVersion($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=')
65
-    {
66
-        global $wp_version;
67
-        return version_compare(
68
-            // first account for wp_version being pre-release
69
-            // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519
70
-            strpos($wp_version, '-') > 0
71
-                ? substr($wp_version, 0, strpos($wp_version, '-'))
72
-                : $wp_version,
73
-            $version_to_check,
74
-            $operator
75
-        );
76
-    }
77
-
78
-
79
-    /**
80
-     * @return boolean
81
-     */
82
-    private function minimumWordPressVersionRequired()
83
-    {
84
-        return RecommendedVersions::compareWordPressVersion();
85
-    }
86
-
87
-
88
-    /**
89
-     * @param string $min_version
90
-     * @return boolean
91
-     */
92
-    private function checkPhpVersion($min_version = EE_MIN_PHP_VER_RECOMMENDED)
93
-    {
94
-        return version_compare(PHP_VERSION, $min_version, '>=') ? true : false;
95
-    }
96
-
97
-
98
-    /**
99
-     * @return boolean
100
-     */
101
-    private function minimumPhpVersionRecommended()
102
-    {
103
-        return $this->checkPhpVersion();
104
-    }
105
-
106
-
107
-    /**
108
-     * @return void
109
-     */
110
-    public function minimumWpVersionError()
111
-    {
112
-        global $wp_version;
113
-        ?>
22
+	/**
23
+	 * converts a Request to a Response
24
+	 *
25
+	 * @param RequestInterface  $request
26
+	 * @param ResponseInterface $response
27
+	 * @return ResponseInterface
28
+	 * @throws InvalidDataTypeException
29
+	 */
30
+	public function handleRequest(RequestInterface $request, ResponseInterface $response)
31
+	{
32
+		$this->request = $request;
33
+		$this->response = $response;
34
+		// check required WP version
35
+		if (! $this->minimumWordPressVersionRequired()) {
36
+			$this->request->unSetRequestParam('activate', true);
37
+			add_action('admin_notices', array($this, 'minimumWpVersionError'), 1);
38
+			$this->response->terminateRequest();
39
+			$this->response->deactivatePlugin();
40
+		}
41
+		// check recommended PHP version
42
+		if (! $this->minimumPhpVersionRecommended()) {
43
+			$this->displayMinimumRecommendedPhpVersionNotice();
44
+		}
45
+		// upcoming required version
46
+		if (! $this->upcomingRequiredPhpVersion()) {
47
+			$this->displayUpcomingRequiredVersion();
48
+		}
49
+		$this->response = $this->processRequestStack($this->request, $this->response);
50
+		return $this->response;
51
+	}
52
+
53
+
54
+	/**
55
+	 * Helper method to assess installed wp version against given values.
56
+	 * By default this compares the required minimum version of WP for EE against the installed version of WP
57
+	 * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked
58
+	 * against) so consider that when sending in your values.
59
+	 *
60
+	 * @param string $version_to_check
61
+	 * @param string $operator
62
+	 * @return bool
63
+	 */
64
+	public static function compareWordPressVersion($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=')
65
+	{
66
+		global $wp_version;
67
+		return version_compare(
68
+			// first account for wp_version being pre-release
69
+			// (like RC, beta etc) which are usually in the format like 4.7-RC3-39519
70
+			strpos($wp_version, '-') > 0
71
+				? substr($wp_version, 0, strpos($wp_version, '-'))
72
+				: $wp_version,
73
+			$version_to_check,
74
+			$operator
75
+		);
76
+	}
77
+
78
+
79
+	/**
80
+	 * @return boolean
81
+	 */
82
+	private function minimumWordPressVersionRequired()
83
+	{
84
+		return RecommendedVersions::compareWordPressVersion();
85
+	}
86
+
87
+
88
+	/**
89
+	 * @param string $min_version
90
+	 * @return boolean
91
+	 */
92
+	private function checkPhpVersion($min_version = EE_MIN_PHP_VER_RECOMMENDED)
93
+	{
94
+		return version_compare(PHP_VERSION, $min_version, '>=') ? true : false;
95
+	}
96
+
97
+
98
+	/**
99
+	 * @return boolean
100
+	 */
101
+	private function minimumPhpVersionRecommended()
102
+	{
103
+		return $this->checkPhpVersion();
104
+	}
105
+
106
+
107
+	/**
108
+	 * @return void
109
+	 */
110
+	public function minimumWpVersionError()
111
+	{
112
+		global $wp_version;
113
+		?>
114 114
         <div class="error">
115 115
             <p>
116 116
                 <?php
117
-                printf(
118
-                    esc_html__(
119
-                        'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.',
120
-                        'event_espresso'
121
-                    ),
122
-                    EE_MIN_WP_VER_REQUIRED,
123
-                    $wp_version,
124
-                    '<br/>',
125
-                    '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>'
126
-                );
127
-                ?>
117
+				printf(
118
+					esc_html__(
119
+						'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.',
120
+						'event_espresso'
121
+					),
122
+					EE_MIN_WP_VER_REQUIRED,
123
+					$wp_version,
124
+					'<br/>',
125
+					'<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>'
126
+				);
127
+				?>
128 128
             </p>
129 129
         </div>
130 130
         <?php
131
-    }
132
-
133
-
134
-    /**
135
-     *    _display_minimum_recommended_php_version_notice
136
-     *
137
-     * @access private
138
-     * @return void
139
-     * @throws InvalidDataTypeException
140
-     */
141
-    private function displayMinimumRecommendedPhpVersionNotice()
142
-    {
143
-        if ($this->request->isAdmin()) {
144
-            new PersistentAdminNotice(
145
-                'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended',
146
-                sprintf(
147
-                    esc_html__(
148
-                        'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
149
-                        'event_espresso'
150
-                    ),
151
-                    EE_MIN_PHP_VER_RECOMMENDED,
152
-                    PHP_VERSION,
153
-                    '<br/>',
154
-                    '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
155
-                )
156
-            );
157
-        }
158
-    }
159
-
160
-
161
-    /**
162
-     * Returns whether the provided php version number is less than the current version of php installed on the server.
163
-     *
164
-     * @param string $version_required
165
-     * @return bool
166
-     */
167
-    private function upcomingRequiredPhpVersion($version_required = '5.5')
168
-    {
169
-        return true;
170
-        // return $this->checkPhpVersion($version_required);
171
-    }
172
-
173
-
174
-    /**
175
-     *  Sets a notice for an upcoming required version of PHP in the next update of EE core.
176
-     */
177
-    private function displayUpcomingRequiredVersion()
178
-    {
179
-        if (
180
-            $this->request->isAdmin()
181
-            && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request)
182
-            && current_user_can('update_plugins')
183
-        ) {
184
-            add_action('admin_notices', function () {
185
-                echo '<div class="notice event-espresso-admin-notice notice-warning"><p>'
186
-                     . sprintf(
187
-                         esc_html__(
188
-                             'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater.  Your web server\'s PHP version is %3$s.  You can contact your host and ask them to update your PHP version to at least PHP 5.6.  Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s',
189
-                             'event_espresso'
190
-                         ),
191
-                         '<strong>',
192
-                         '</strong>',
193
-                         PHP_VERSION,
194
-                         '<a href="https://wordpress.org/support/upgrade-php/">',
195
-                         '</a>'
196
-                     )
197
-                     . '</p></div>';
198
-            });
199
-        }
200
-    }
131
+	}
132
+
133
+
134
+	/**
135
+	 *    _display_minimum_recommended_php_version_notice
136
+	 *
137
+	 * @access private
138
+	 * @return void
139
+	 * @throws InvalidDataTypeException
140
+	 */
141
+	private function displayMinimumRecommendedPhpVersionNotice()
142
+	{
143
+		if ($this->request->isAdmin()) {
144
+			new PersistentAdminNotice(
145
+				'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended',
146
+				sprintf(
147
+					esc_html__(
148
+						'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
149
+						'event_espresso'
150
+					),
151
+					EE_MIN_PHP_VER_RECOMMENDED,
152
+					PHP_VERSION,
153
+					'<br/>',
154
+					'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
155
+				)
156
+			);
157
+		}
158
+	}
159
+
160
+
161
+	/**
162
+	 * Returns whether the provided php version number is less than the current version of php installed on the server.
163
+	 *
164
+	 * @param string $version_required
165
+	 * @return bool
166
+	 */
167
+	private function upcomingRequiredPhpVersion($version_required = '5.5')
168
+	{
169
+		return true;
170
+		// return $this->checkPhpVersion($version_required);
171
+	}
172
+
173
+
174
+	/**
175
+	 *  Sets a notice for an upcoming required version of PHP in the next update of EE core.
176
+	 */
177
+	private function displayUpcomingRequiredVersion()
178
+	{
179
+		if (
180
+			$this->request->isAdmin()
181
+			&& apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request)
182
+			&& current_user_can('update_plugins')
183
+		) {
184
+			add_action('admin_notices', function () {
185
+				echo '<div class="notice event-espresso-admin-notice notice-warning"><p>'
186
+					 . sprintf(
187
+						 esc_html__(
188
+							 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater.  Your web server\'s PHP version is %3$s.  You can contact your host and ask them to update your PHP version to at least PHP 5.6.  Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s',
189
+							 'event_espresso'
190
+						 ),
191
+						 '<strong>',
192
+						 '</strong>',
193
+						 PHP_VERSION,
194
+						 '<a href="https://wordpress.org/support/upgrade-php/">',
195
+						 '</a>'
196
+					 )
197
+					 . '</p></div>';
198
+			});
199
+		}
200
+	}
201 201
 }
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/entities/editor/Block.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      */
82 82
     public function namespacedBlockType()
83 83
     {
84
-        return self::NAME_SPACE . '/' . $this->block_type;
84
+        return self::NAME_SPACE.'/'.$this->block_type;
85 85
     }
86 86
 
87 87
 
Please login to merge, or discard this patch.
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -21,211 +21,211 @@
 block discarded – undo
21 21
 abstract class Block implements BlockInterface
22 22
 {
23 23
 
24
-    /**
25
-     * BlockAssetManager that this editor block uses for asset registration
26
-     *
27
-     * @var BlockAssetManagerInterface $block_asset_manager
28
-     */
29
-    protected $block_asset_manager;
30
-
31
-    /**
32
-     * @var RequestInterface $request
33
-     */
34
-    protected $request;
35
-
36
-    /**
37
-     * @var array $attributes
38
-     */
39
-    private $attributes;
40
-
41
-    /**
42
-     * If set to true, then the block will render its content client side
43
-     * If false, then the block will render its content server side using the renderBlock() method
44
-     *
45
-     * @var bool $dynamic
46
-     */
47
-    private $dynamic = false;
48
-
49
-    /**
50
-     * @var string $block_type
51
-     */
52
-    private $block_type;
53
-
54
-    /**
55
-     * @var array $supported_routes
56
-     */
57
-    private $supported_routes;
58
-
59
-    /**
60
-     * @var WP_Block_Type $wp_block_type
61
-     */
62
-    private $wp_block_type;
63
-
64
-
65
-    /**
66
-     * BlockLoader constructor.
67
-     *
68
-     * @param BlockAssetManagerInterface $block_asset_manager
69
-     * @param RequestInterface           $request
70
-     */
71
-    public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request)
72
-    {
73
-        $this->block_asset_manager = $block_asset_manager;
74
-        $this->request = $request;
75
-    }
76
-
77
-
78
-    /**
79
-     * @return string
80
-     */
81
-    public function blockType()
82
-    {
83
-        return $this->block_type;
84
-    }
85
-
86
-
87
-    /**
88
-     * @return string
89
-     */
90
-    public function namespacedBlockType()
91
-    {
92
-        return self::NAME_SPACE . '/' . $this->block_type;
93
-    }
94
-
95
-
96
-    /**
97
-     * @param string $block_type
98
-     */
99
-    protected function setBlockType($block_type)
100
-    {
101
-        $this->block_type = $block_type;
102
-    }
103
-
104
-
105
-    /**
106
-     * BlockAssetManager that this editor block uses for asset registration
107
-     *
108
-     * @return BlockAssetManagerInterface
109
-     */
110
-    public function assetManager()
111
-    {
112
-        return $this->block_asset_manager;
113
-    }
114
-
115
-
116
-    /**
117
-     * @param WP_Block_Type $wp_block_type
118
-     */
119
-    protected function setWpBlockType($wp_block_type)
120
-    {
121
-        $this->wp_block_type = $wp_block_type;
122
-    }
123
-
124
-    /**
125
-     * returns an array of fully qualified class names
126
-     * for RouteMatchSpecificationInterface objects
127
-     * that specify routes that the block should be loaded for.
128
-     *
129
-     * @return array
130
-     */
131
-    public function supportedRoutes()
132
-    {
133
-        return $this->supported_routes;
134
-    }
135
-
136
-
137
-    /**
138
-     * @param array $supported_routes
139
-     */
140
-    protected function setSupportedRoutes(array $supported_routes)
141
-    {
142
-        $this->supported_routes = $supported_routes;
143
-    }
144
-
145
-
146
-    /**
147
-     * @return array
148
-     */
149
-    public function attributes()
150
-    {
151
-        return $this->attributes;
152
-    }
153
-
154
-
155
-    /**
156
-     * @param array $attributes
157
-     */
158
-    public function setAttributes(array $attributes)
159
-    {
160
-        $this->attributes = $attributes;
161
-    }
162
-
163
-
164
-    /**
165
-     * @return bool
166
-     */
167
-    public function isDynamic()
168
-    {
169
-        return $this->dynamic;
170
-    }
171
-
172
-
173
-    /**
174
-     * @param bool $dynamic
175
-     */
176
-    public function setDynamic($dynamic = true)
177
-    {
178
-        $this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN);
179
-    }
180
-
181
-
182
-    /**
183
-     * Registers the Editor Block with WP core;
184
-     * Returns the registered block type on success, or false on failure.
185
-     *
186
-     * @return WP_Block_Type|false
187
-     */
188
-    public function registerBlock()
189
-    {
190
-        $args = array(
191
-            'attributes'    => $this->attributes(),
192
-            'editor_script' => $this->block_asset_manager->getEditorScriptHandle(),
193
-            'editor_style'  => $this->block_asset_manager->getEditorStyleHandle(),
194
-            'script'        => $this->block_asset_manager->getScriptHandle(),
195
-            'style'         => $this->block_asset_manager->getStyleHandle(),
196
-        );
197
-        if ($this->isDynamic()) {
198
-            $args['render_callback'] = array($this, 'renderBlock');
199
-        }
200
-        $wp_block_type = register_block_type(
201
-            new WP_Block_Type(
202
-                $this->namespacedBlockType(),
203
-                $args
204
-            )
205
-        );
206
-        $this->setWpBlockType($wp_block_type);
207
-        return $wp_block_type;
208
-    }
209
-
210
-
211
-    /**
212
-     * @return WP_Block_Type|false The registered block type on success, or false on failure.
213
-     */
214
-    public function unRegisterBlock()
215
-    {
216
-        return unregister_block_type($this->namespacedBlockType());
217
-    }
218
-
219
-
220
-
221
-    /**
222
-     * @return array
223
-     */
224
-    public function getEditorContainer()
225
-    {
226
-        return array(
227
-            $this->namespacedBlockType(),
228
-            array(),
229
-        );
230
-    }
24
+	/**
25
+	 * BlockAssetManager that this editor block uses for asset registration
26
+	 *
27
+	 * @var BlockAssetManagerInterface $block_asset_manager
28
+	 */
29
+	protected $block_asset_manager;
30
+
31
+	/**
32
+	 * @var RequestInterface $request
33
+	 */
34
+	protected $request;
35
+
36
+	/**
37
+	 * @var array $attributes
38
+	 */
39
+	private $attributes;
40
+
41
+	/**
42
+	 * If set to true, then the block will render its content client side
43
+	 * If false, then the block will render its content server side using the renderBlock() method
44
+	 *
45
+	 * @var bool $dynamic
46
+	 */
47
+	private $dynamic = false;
48
+
49
+	/**
50
+	 * @var string $block_type
51
+	 */
52
+	private $block_type;
53
+
54
+	/**
55
+	 * @var array $supported_routes
56
+	 */
57
+	private $supported_routes;
58
+
59
+	/**
60
+	 * @var WP_Block_Type $wp_block_type
61
+	 */
62
+	private $wp_block_type;
63
+
64
+
65
+	/**
66
+	 * BlockLoader constructor.
67
+	 *
68
+	 * @param BlockAssetManagerInterface $block_asset_manager
69
+	 * @param RequestInterface           $request
70
+	 */
71
+	public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request)
72
+	{
73
+		$this->block_asset_manager = $block_asset_manager;
74
+		$this->request = $request;
75
+	}
76
+
77
+
78
+	/**
79
+	 * @return string
80
+	 */
81
+	public function blockType()
82
+	{
83
+		return $this->block_type;
84
+	}
85
+
86
+
87
+	/**
88
+	 * @return string
89
+	 */
90
+	public function namespacedBlockType()
91
+	{
92
+		return self::NAME_SPACE . '/' . $this->block_type;
93
+	}
94
+
95
+
96
+	/**
97
+	 * @param string $block_type
98
+	 */
99
+	protected function setBlockType($block_type)
100
+	{
101
+		$this->block_type = $block_type;
102
+	}
103
+
104
+
105
+	/**
106
+	 * BlockAssetManager that this editor block uses for asset registration
107
+	 *
108
+	 * @return BlockAssetManagerInterface
109
+	 */
110
+	public function assetManager()
111
+	{
112
+		return $this->block_asset_manager;
113
+	}
114
+
115
+
116
+	/**
117
+	 * @param WP_Block_Type $wp_block_type
118
+	 */
119
+	protected function setWpBlockType($wp_block_type)
120
+	{
121
+		$this->wp_block_type = $wp_block_type;
122
+	}
123
+
124
+	/**
125
+	 * returns an array of fully qualified class names
126
+	 * for RouteMatchSpecificationInterface objects
127
+	 * that specify routes that the block should be loaded for.
128
+	 *
129
+	 * @return array
130
+	 */
131
+	public function supportedRoutes()
132
+	{
133
+		return $this->supported_routes;
134
+	}
135
+
136
+
137
+	/**
138
+	 * @param array $supported_routes
139
+	 */
140
+	protected function setSupportedRoutes(array $supported_routes)
141
+	{
142
+		$this->supported_routes = $supported_routes;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @return array
148
+	 */
149
+	public function attributes()
150
+	{
151
+		return $this->attributes;
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param array $attributes
157
+	 */
158
+	public function setAttributes(array $attributes)
159
+	{
160
+		$this->attributes = $attributes;
161
+	}
162
+
163
+
164
+	/**
165
+	 * @return bool
166
+	 */
167
+	public function isDynamic()
168
+	{
169
+		return $this->dynamic;
170
+	}
171
+
172
+
173
+	/**
174
+	 * @param bool $dynamic
175
+	 */
176
+	public function setDynamic($dynamic = true)
177
+	{
178
+		$this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN);
179
+	}
180
+
181
+
182
+	/**
183
+	 * Registers the Editor Block with WP core;
184
+	 * Returns the registered block type on success, or false on failure.
185
+	 *
186
+	 * @return WP_Block_Type|false
187
+	 */
188
+	public function registerBlock()
189
+	{
190
+		$args = array(
191
+			'attributes'    => $this->attributes(),
192
+			'editor_script' => $this->block_asset_manager->getEditorScriptHandle(),
193
+			'editor_style'  => $this->block_asset_manager->getEditorStyleHandle(),
194
+			'script'        => $this->block_asset_manager->getScriptHandle(),
195
+			'style'         => $this->block_asset_manager->getStyleHandle(),
196
+		);
197
+		if ($this->isDynamic()) {
198
+			$args['render_callback'] = array($this, 'renderBlock');
199
+		}
200
+		$wp_block_type = register_block_type(
201
+			new WP_Block_Type(
202
+				$this->namespacedBlockType(),
203
+				$args
204
+			)
205
+		);
206
+		$this->setWpBlockType($wp_block_type);
207
+		return $wp_block_type;
208
+	}
209
+
210
+
211
+	/**
212
+	 * @return WP_Block_Type|false The registered block type on success, or false on failure.
213
+	 */
214
+	public function unRegisterBlock()
215
+	{
216
+		return unregister_block_type($this->namespacedBlockType());
217
+	}
218
+
219
+
220
+
221
+	/**
222
+	 * @return array
223
+	 */
224
+	public function getEditorContainer()
225
+	{
226
+		return array(
227
+			$this->namespacedBlockType(),
228
+			array(),
229
+		);
230
+	}
231 231
 }
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/forms/PrivacySettingsFormHandler.php 1 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.
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   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -44,530 +44,530 @@
 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
-                            ),
351
-                            '',
352
-                            'site-license-key-hdr'
353
-                        )
354
-                    ),
355
-                    'site_license_key' => $this->getSiteLicenseKeyField()
356
-                )
357
-            );
358
-            $form->add_subsections(
359
-                array(
360
-                    'uxip_optin_hdr' => new EE_Form_Section_HTML(
361
-                        $this->uxipOptinText()
362
-                    ),
363
-                    'ueip_optin' => new EE_Checkbox_Multi_Input(
364
-                        array(
365
-                            true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso')
366
-                        ),
367
-                        array(
368
-                            'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
369
-                            'html_label_text' => esc_html__(
370
-                                'UXIP Opt In?',
371
-                                'event_espresso'
372
-                            ),
373
-                            'default'         => isset($this->core_config->ee_ueip_optin)
374
-                                ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
375
-                                : false,
376
-                            'required'        => false,
377
-                        )
378
-                    ),
379
-                ),
380
-                'organization_instagram',
381
-                false
382
-            );
383
-        }
384
-        return $form;
385
-    }
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
+							),
351
+							'',
352
+							'site-license-key-hdr'
353
+						)
354
+					),
355
+					'site_license_key' => $this->getSiteLicenseKeyField()
356
+				)
357
+			);
358
+			$form->add_subsections(
359
+				array(
360
+					'uxip_optin_hdr' => new EE_Form_Section_HTML(
361
+						$this->uxipOptinText()
362
+					),
363
+					'ueip_optin' => new EE_Checkbox_Multi_Input(
364
+						array(
365
+							true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso')
366
+						),
367
+						array(
368
+							'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
369
+							'html_label_text' => esc_html__(
370
+								'UXIP Opt In?',
371
+								'event_espresso'
372
+							),
373
+							'default'         => isset($this->core_config->ee_ueip_optin)
374
+								? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
375
+								: false,
376
+							'required'        => false,
377
+						)
378
+					),
379
+				),
380
+				'organization_instagram',
381
+				false
382
+			);
383
+		}
384
+		return $form;
385
+	}
386 386
 
387 387
 
388
-    /**
389
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
390
-     * returns a string of HTML that can be directly echoed in a template
391
-     *
392
-     * @return string
393
-     * @throws EE_Error
394
-     * @throws InvalidArgumentException
395
-     * @throws InvalidDataTypeException
396
-     * @throws InvalidInterfaceException
397
-     * @throws LogicException
398
-     */
399
-    public function display()
400
-    {
401
-        $this->form()->enqueue_js();
402
-        return parent::display();
403
-    }
388
+	/**
389
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
390
+	 * returns a string of HTML that can be directly echoed in a template
391
+	 *
392
+	 * @return string
393
+	 * @throws EE_Error
394
+	 * @throws InvalidArgumentException
395
+	 * @throws InvalidDataTypeException
396
+	 * @throws InvalidInterfaceException
397
+	 * @throws LogicException
398
+	 */
399
+	public function display()
400
+	{
401
+		$this->form()->enqueue_js();
402
+		return parent::display();
403
+	}
404 404
 
405 405
 
406
-    /**
407
-     * handles processing the form submission
408
-     * returns true or false depending on whether the form was processed successfully or not
409
-     *
410
-     * @param array $form_data
411
-     * @return bool
412
-     * @throws InvalidFormSubmissionException
413
-     * @throws EE_Error
414
-     * @throws LogicException
415
-     * @throws InvalidArgumentException
416
-     * @throws InvalidDataTypeException
417
-     * @throws ReflectionException
418
-     */
419
-    public function process($form_data = array())
420
-    {
421
-        // process form
422
-        $valid_data = (array) parent::process($form_data);
423
-        if (empty($valid_data)) {
424
-            return false;
425
-        }
406
+	/**
407
+	 * handles processing the form submission
408
+	 * returns true or false depending on whether the form was processed successfully or not
409
+	 *
410
+	 * @param array $form_data
411
+	 * @return bool
412
+	 * @throws InvalidFormSubmissionException
413
+	 * @throws EE_Error
414
+	 * @throws LogicException
415
+	 * @throws InvalidArgumentException
416
+	 * @throws InvalidDataTypeException
417
+	 * @throws ReflectionException
418
+	 */
419
+	public function process($form_data = array())
420
+	{
421
+		// process form
422
+		$valid_data = (array) parent::process($form_data);
423
+		if (empty($valid_data)) {
424
+			return false;
425
+		}
426 426
 
427
-        if (is_main_site()) {
428
-            $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
429
-                ? sanitize_text_field($form_data['ee_site_license_key'])
430
-                : $this->network_core_config->site_license_key;
431
-        }
432
-        $this->organization_config->name = isset($form_data['organization_name'])
433
-            ? sanitize_text_field($form_data['organization_name'])
434
-            : $this->organization_config->name;
435
-        $this->organization_config->address_1 = isset($form_data['organization_address_1'])
436
-            ? sanitize_text_field($form_data['organization_address_1'])
437
-            : $this->organization_config->address_1;
438
-        $this->organization_config->address_2 = isset($form_data['organization_address_2'])
439
-            ? sanitize_text_field($form_data['organization_address_2'])
440
-            : $this->organization_config->address_2;
441
-        $this->organization_config->city = isset($form_data['organization_city'])
442
-            ? sanitize_text_field($form_data['organization_city'])
443
-            : $this->organization_config->city;
444
-        $this->organization_config->STA_ID = isset($form_data['organization_state'])
445
-            ? absint($form_data['organization_state'])
446
-            : $this->organization_config->STA_ID;
447
-        $this->organization_config->CNT_ISO = isset($form_data['organization_country'])
448
-            ? sanitize_text_field($form_data['organization_country'])
449
-            : $this->organization_config->CNT_ISO;
450
-        $this->organization_config->zip = isset($form_data['organization_zip'])
451
-            ? sanitize_text_field($form_data['organization_zip'])
452
-            : $this->organization_config->zip;
453
-        $this->organization_config->email = isset($form_data['organization_email'])
454
-            ? sanitize_email($form_data['organization_email'])
455
-            : $this->organization_config->email;
456
-        $this->organization_config->vat = isset($form_data['organization_vat'])
457
-            ? sanitize_text_field($form_data['organization_vat'])
458
-            : $this->organization_config->vat;
459
-        $this->organization_config->phone = isset($form_data['organization_phone'])
460
-            ? sanitize_text_field($form_data['organization_phone'])
461
-            : $this->organization_config->phone;
462
-        $this->organization_config->logo_url = isset($form_data['organization_logo_url'])
463
-            ? esc_url_raw($form_data['organization_logo_url'])
464
-            : $this->organization_config->logo_url;
465
-        $this->organization_config->facebook = isset($form_data['organization_facebook'])
466
-            ? esc_url_raw($form_data['organization_facebook'])
467
-            : $this->organization_config->facebook;
468
-        $this->organization_config->twitter = isset($form_data['organization_twitter'])
469
-            ? esc_url_raw($form_data['organization_twitter'])
470
-            : $this->organization_config->twitter;
471
-        $this->organization_config->linkedin = isset($form_data['organization_linkedin'])
472
-            ? esc_url_raw($form_data['organization_linkedin'])
473
-            : $this->organization_config->linkedin;
474
-        $this->organization_config->pinterest = isset($form_data['organization_pinterest'])
475
-            ? esc_url_raw($form_data['organization_pinterest'])
476
-            : $this->organization_config->pinterest;
477
-        $this->organization_config->google = isset($form_data['organization_google'])
478
-            ? esc_url_raw($form_data['organization_google'])
479
-            : $this->organization_config->google;
480
-        $this->organization_config->instagram = isset($form_data['organization_instagram'])
481
-            ? esc_url_raw($form_data['organization_instagram'])
482
-            : $this->organization_config->instagram;
483
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
484
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
485
-            : false;
486
-        $this->core_config->ee_ueip_has_notified = true;
427
+		if (is_main_site()) {
428
+			$this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
429
+				? sanitize_text_field($form_data['ee_site_license_key'])
430
+				: $this->network_core_config->site_license_key;
431
+		}
432
+		$this->organization_config->name = isset($form_data['organization_name'])
433
+			? sanitize_text_field($form_data['organization_name'])
434
+			: $this->organization_config->name;
435
+		$this->organization_config->address_1 = isset($form_data['organization_address_1'])
436
+			? sanitize_text_field($form_data['organization_address_1'])
437
+			: $this->organization_config->address_1;
438
+		$this->organization_config->address_2 = isset($form_data['organization_address_2'])
439
+			? sanitize_text_field($form_data['organization_address_2'])
440
+			: $this->organization_config->address_2;
441
+		$this->organization_config->city = isset($form_data['organization_city'])
442
+			? sanitize_text_field($form_data['organization_city'])
443
+			: $this->organization_config->city;
444
+		$this->organization_config->STA_ID = isset($form_data['organization_state'])
445
+			? absint($form_data['organization_state'])
446
+			: $this->organization_config->STA_ID;
447
+		$this->organization_config->CNT_ISO = isset($form_data['organization_country'])
448
+			? sanitize_text_field($form_data['organization_country'])
449
+			: $this->organization_config->CNT_ISO;
450
+		$this->organization_config->zip = isset($form_data['organization_zip'])
451
+			? sanitize_text_field($form_data['organization_zip'])
452
+			: $this->organization_config->zip;
453
+		$this->organization_config->email = isset($form_data['organization_email'])
454
+			? sanitize_email($form_data['organization_email'])
455
+			: $this->organization_config->email;
456
+		$this->organization_config->vat = isset($form_data['organization_vat'])
457
+			? sanitize_text_field($form_data['organization_vat'])
458
+			: $this->organization_config->vat;
459
+		$this->organization_config->phone = isset($form_data['organization_phone'])
460
+			? sanitize_text_field($form_data['organization_phone'])
461
+			: $this->organization_config->phone;
462
+		$this->organization_config->logo_url = isset($form_data['organization_logo_url'])
463
+			? esc_url_raw($form_data['organization_logo_url'])
464
+			: $this->organization_config->logo_url;
465
+		$this->organization_config->facebook = isset($form_data['organization_facebook'])
466
+			? esc_url_raw($form_data['organization_facebook'])
467
+			: $this->organization_config->facebook;
468
+		$this->organization_config->twitter = isset($form_data['organization_twitter'])
469
+			? esc_url_raw($form_data['organization_twitter'])
470
+			: $this->organization_config->twitter;
471
+		$this->organization_config->linkedin = isset($form_data['organization_linkedin'])
472
+			? esc_url_raw($form_data['organization_linkedin'])
473
+			: $this->organization_config->linkedin;
474
+		$this->organization_config->pinterest = isset($form_data['organization_pinterest'])
475
+			? esc_url_raw($form_data['organization_pinterest'])
476
+			: $this->organization_config->pinterest;
477
+		$this->organization_config->google = isset($form_data['organization_google'])
478
+			? esc_url_raw($form_data['organization_google'])
479
+			: $this->organization_config->google;
480
+		$this->organization_config->instagram = isset($form_data['organization_instagram'])
481
+			? esc_url_raw($form_data['organization_instagram'])
482
+			: $this->organization_config->instagram;
483
+		$this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
484
+			? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
485
+			: false;
486
+		$this->core_config->ee_ueip_has_notified = true;
487 487
 
488
-        $this->registry->CFG->currency = new EE_Currency_Config(
489
-            $this->organization_config->CNT_ISO
490
-        );
491
-        /** @var EE_Country $country */
492
-        $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
493
-        if ($country instanceof EE_Country) {
494
-            $country->set('CNT_active', 1);
495
-            $country->save();
496
-            $this->countrySubRegionDao->saveCountrySubRegions($country);
497
-        }
498
-        return true;
499
-    }
488
+		$this->registry->CFG->currency = new EE_Currency_Config(
489
+			$this->organization_config->CNT_ISO
490
+		);
491
+		/** @var EE_Country $country */
492
+		$country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
493
+		if ($country instanceof EE_Country) {
494
+			$country->set('CNT_active', 1);
495
+			$country->save();
496
+			$this->countrySubRegionDao->saveCountrySubRegions($country);
497
+		}
498
+		return true;
499
+	}
500 500
 
501 501
 
502
-    /**
503
-     * @return string
504
-     */
505
-    private function uxipOptinText()
506
-    {
507
-        ob_start();
508
-        Stats::optinText(false);
509
-        return ob_get_clean();
510
-    }
502
+	/**
503
+	 * @return string
504
+	 */
505
+	private function uxipOptinText()
506
+	{
507
+		ob_start();
508
+		Stats::optinText(false);
509
+		return ob_get_clean();
510
+	}
511 511
 
512 512
 
513
-    /**
514
-     * Return whether the site license key has been verified or not.
515
-     * @return bool
516
-     */
517
-    private function licenseKeyVerified()
518
-    {
519
-        if (empty($this->network_core_config->site_license_key)) {
520
-            return false;
521
-        }
522
-        $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
523
-        $verify_fail = get_option($ver_option_key, false);
524
-        return $verify_fail === false
525
-                  || (! empty($this->network_core_config->site_license_key)
526
-                        && $verify_fail === false
527
-                  );
528
-    }
513
+	/**
514
+	 * Return whether the site license key has been verified or not.
515
+	 * @return bool
516
+	 */
517
+	private function licenseKeyVerified()
518
+	{
519
+		if (empty($this->network_core_config->site_license_key)) {
520
+			return false;
521
+		}
522
+		$ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
523
+		$verify_fail = get_option($ver_option_key, false);
524
+		return $verify_fail === false
525
+				  || (! empty($this->network_core_config->site_license_key)
526
+						&& $verify_fail === false
527
+				  );
528
+	}
529 529
 
530 530
 
531
-    /**
532
-     * @return EE_Text_Input
533
-     */
534
-    private function getSiteLicenseKeyField()
535
-    {
536
-        $text_input = new EE_Text_Input(
537
-            array(
538
-                'html_name' => 'ee_site_license_key',
539
-                'html_id' => 'site_license_key',
540
-                'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
541
-                /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
542
-                'html_help_text'  => sprintf(
543
-                    esc_html__(
544
-                        '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.',
545
-                        'event_espresso'
546
-                    ),
547
-                    '<strong>',
548
-                    '</strong>'
549
-                ),
550
-                /** phpcs:enable */
551
-                'default'         => isset($this->network_core_config->site_license_key)
552
-                    ? $this->network_core_config->site_license_key
553
-                    : '',
554
-                'required'        => false,
555
-                'form_html_filter' => new VsprintfFilter(
556
-                    '%2$s %1$s',
557
-                    array($this->getValidationIndicator())
558
-                )
559
-            )
560
-        );
561
-        return $text_input;
562
-    }
531
+	/**
532
+	 * @return EE_Text_Input
533
+	 */
534
+	private function getSiteLicenseKeyField()
535
+	{
536
+		$text_input = new EE_Text_Input(
537
+			array(
538
+				'html_name' => 'ee_site_license_key',
539
+				'html_id' => 'site_license_key',
540
+				'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
541
+				/** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
542
+				'html_help_text'  => sprintf(
543
+					esc_html__(
544
+						'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.',
545
+						'event_espresso'
546
+					),
547
+					'<strong>',
548
+					'</strong>'
549
+				),
550
+				/** phpcs:enable */
551
+				'default'         => isset($this->network_core_config->site_license_key)
552
+					? $this->network_core_config->site_license_key
553
+					: '',
554
+				'required'        => false,
555
+				'form_html_filter' => new VsprintfFilter(
556
+					'%2$s %1$s',
557
+					array($this->getValidationIndicator())
558
+				)
559
+			)
560
+		);
561
+		return $text_input;
562
+	}
563 563
 
564 564
 
565
-    /**
566
-     * @return string
567
-     */
568
-    private function getValidationIndicator()
569
-    {
570
-        $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
571
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
572
-    }
565
+	/**
566
+	 * @return string
567
+	 */
568
+	private function getValidationIndicator()
569
+	{
570
+		$verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
571
+		return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
572
+	}
573 573
 }
Please login to merge, or discard this patch.
strategies/display/EE_Radio_Button_Display_Strategy.strategy.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -11,61 +11,61 @@
 block discarded – undo
11 11
 class EE_Radio_Button_Display_Strategy extends EE_Compound_Input_Display_Strategy
12 12
 {
13 13
 
14
-    /**
15
-     *
16
-     * @throws EE_Error
17
-     * @return string of html to display the field
18
-     */
19
-    public function display()
20
-    {
21
-        $input = $this->get_input();
22
-        $input->set_label_sizes();
23
-        $label_size_class = $input->get_label_size_class();
24
-        $html = '';
25
-        foreach ($input->options() as $value => $display_text) {
26
-            $value = $input->get_normalization_strategy()->unnormalize($value);
14
+	/**
15
+	 *
16
+	 * @throws EE_Error
17
+	 * @return string of html to display the field
18
+	 */
19
+	public function display()
20
+	{
21
+		$input = $this->get_input();
22
+		$input->set_label_sizes();
23
+		$label_size_class = $input->get_label_size_class();
24
+		$html = '';
25
+		foreach ($input->options() as $value => $display_text) {
26
+			$value = $input->get_normalization_strategy()->unnormalize($value);
27 27
 
28
-            $html_id = $this->get_sub_input_id($value);
29
-            $html .= EEH_HTML::nl(0, 'radio');
28
+			$html_id = $this->get_sub_input_id($value);
29
+			$html .= EEH_HTML::nl(0, 'radio');
30 30
 
31
-            $html .= $this->_opening_tag('label');
32
-            $html .= $this->_attributes_string(
33
-                array(
34
-                    'for' => $html_id,
35
-                    'id' => $html_id . '-lbl',
36
-                    'class' => apply_filters(
37
-                        'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class',
38
-                        'ee-radio-label-after' . $label_size_class,
39
-                        $this,
40
-                        $input,
41
-                        $value
42
-                    )
43
-                )
44
-            );
45
-            $html .= '>';
46
-            $html .= EEH_HTML::nl(1, 'radio');
47
-            $html .= $this->_opening_tag('input');
48
-            $attributes = array(
49
-                'id' => $html_id,
50
-                'name' => $input->html_name(),
51
-                'class' => $input->html_class(),
52
-                'style' => $input->html_style(),
53
-                'type' => 'radio',
54
-                'value' => $value,
55
-                0 => $input->other_html_attributes(),
56
-                'data-question_label' => $input->html_label_id()
57
-            );
58
-            if ($input->raw_value() === $value) {
59
-                $attributes['checked'] = 'checked';
60
-            }
61
-            $html .= $this->_attributes_string($attributes);
31
+			$html .= $this->_opening_tag('label');
32
+			$html .= $this->_attributes_string(
33
+				array(
34
+					'for' => $html_id,
35
+					'id' => $html_id . '-lbl',
36
+					'class' => apply_filters(
37
+						'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class',
38
+						'ee-radio-label-after' . $label_size_class,
39
+						$this,
40
+						$input,
41
+						$value
42
+					)
43
+				)
44
+			);
45
+			$html .= '>';
46
+			$html .= EEH_HTML::nl(1, 'radio');
47
+			$html .= $this->_opening_tag('input');
48
+			$attributes = array(
49
+				'id' => $html_id,
50
+				'name' => $input->html_name(),
51
+				'class' => $input->html_class(),
52
+				'style' => $input->html_style(),
53
+				'type' => 'radio',
54
+				'value' => $value,
55
+				0 => $input->other_html_attributes(),
56
+				'data-question_label' => $input->html_label_id()
57
+			);
58
+			if ($input->raw_value() === $value) {
59
+				$attributes['checked'] = 'checked';
60
+			}
61
+			$html .= $this->_attributes_string($attributes);
62 62
 
63
-            $html .= '>&nbsp;';
64
-            $html .= $display_text;
65
-            $html .= EEH_HTML::nl(-1, 'radio') . '</label>';
66
-        }
67
-        $html .= EEH_HTML::div('', '', 'clear-float');
68
-        $html .= EEH_HTML::divx();
69
-        return apply_filters('FHEE__EE_Radio_Button_Display_Strategy__display', $html, $this, $this->_input);
70
-    }
63
+			$html .= '>&nbsp;';
64
+			$html .= $display_text;
65
+			$html .= EEH_HTML::nl(-1, 'radio') . '</label>';
66
+		}
67
+		$html .= EEH_HTML::div('', '', 'clear-float');
68
+		$html .= EEH_HTML::divx();
69
+		return apply_filters('FHEE__EE_Radio_Button_Display_Strategy__display', $html, $this, $this->_input);
70
+	}
71 71
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
             $html .= $this->_attributes_string(
33 33
                 array(
34 34
                     'for' => $html_id,
35
-                    'id' => $html_id . '-lbl',
35
+                    'id' => $html_id.'-lbl',
36 36
                     'class' => apply_filters(
37 37
                         'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class',
38
-                        'ee-radio-label-after' . $label_size_class,
38
+                        'ee-radio-label-after'.$label_size_class,
39 39
                         $this,
40 40
                         $input,
41 41
                         $value
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
             $html .= '>&nbsp;';
64 64
             $html .= $display_text;
65
-            $html .= EEH_HTML::nl(-1, 'radio') . '</label>';
65
+            $html .= EEH_HTML::nl(-1, 'radio').'</label>';
66 66
         }
67 67
         $html .= EEH_HTML::div('', '', 'clear-float');
68 68
         $html .= EEH_HTML::divx();
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/erasure/EraseAttendeeData.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -16,74 +16,74 @@
 block discarded – undo
16 16
 class EraseAttendeeData implements PersonalDataEraserInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @var EEM_Attendee
21
-     */
22
-    protected $attendee_model;
19
+	/**
20
+	 * @var EEM_Attendee
21
+	 */
22
+	protected $attendee_model;
23 23
 
24 24
 
25
-    /**
26
-     * EraseAttendeeData constructor.
27
-     *
28
-     * @param EEM_Attendee $attendee_model
29
-     */
30
-    public function __construct(EEM_Attendee $attendee_model)
31
-    {
32
-        $this->attendee_model = $attendee_model;
33
-    }
25
+	/**
26
+	 * EraseAttendeeData constructor.
27
+	 *
28
+	 * @param EEM_Attendee $attendee_model
29
+	 */
30
+	public function __construct(EEM_Attendee $attendee_model)
31
+	{
32
+		$this->attendee_model = $attendee_model;
33
+	}
34 34
 
35 35
 
36
-    /**
37
-     * Gets a translated string name for the data eraser
38
-     *
39
-     * @return string
40
-     */
41
-    public function name()
42
-    {
43
-        return esc_html__('Event Espresso Attendee Data', 'event_espresso');
44
-    }
36
+	/**
37
+	 * Gets a translated string name for the data eraser
38
+	 *
39
+	 * @return string
40
+	 */
41
+	public function name()
42
+	{
43
+		return esc_html__('Event Espresso Attendee Data', 'event_espresso');
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * Erases a "page" of personal user data
49
-     *
50
-     * @return array {
51
-     * @type boolean $items_removed  whether items were removed successfully or not
52
-     * @type boolean $items_retained whether any items were skipped or not
53
-     * @type array   $messages       values are messages to show
54
-     * @type boolean $done           whether this eraser is done or has more pages
55
-     *               }
56
-     * @throws \EE_Error
57
-     */
58
-    public function erase($email_address, $page = 1)
59
-    {
60
-        $rows_updated = $this->attendee_model->update(
61
-            array(
62
-                'ATT_fname'    => esc_html__('Anonymous', 'event_espresso'),
63
-                'ATT_lname'    => '',
64
-                'ATT_email'    => '',
65
-                'ATT_address'  => '',
66
-                'ATT_address2' => '',
67
-                'ATT_city'     => '',
68
-                'STA_ID'       => 0,
69
-                'CNT_ISO'      => '',
70
-                'ATT_zip'      => '',
71
-                'ATT_phone'    => '',
72
-            ),
73
-            array(
74
-                array(
75
-                    'ATT_email' => $email_address,
76
-                ),
77
-            )
78
-        );
47
+	/**
48
+	 * Erases a "page" of personal user data
49
+	 *
50
+	 * @return array {
51
+	 * @type boolean $items_removed  whether items were removed successfully or not
52
+	 * @type boolean $items_retained whether any items were skipped or not
53
+	 * @type array   $messages       values are messages to show
54
+	 * @type boolean $done           whether this eraser is done or has more pages
55
+	 *               }
56
+	 * @throws \EE_Error
57
+	 */
58
+	public function erase($email_address, $page = 1)
59
+	{
60
+		$rows_updated = $this->attendee_model->update(
61
+			array(
62
+				'ATT_fname'    => esc_html__('Anonymous', 'event_espresso'),
63
+				'ATT_lname'    => '',
64
+				'ATT_email'    => '',
65
+				'ATT_address'  => '',
66
+				'ATT_address2' => '',
67
+				'ATT_city'     => '',
68
+				'STA_ID'       => 0,
69
+				'CNT_ISO'      => '',
70
+				'ATT_zip'      => '',
71
+				'ATT_phone'    => '',
72
+			),
73
+			array(
74
+				array(
75
+					'ATT_email' => $email_address,
76
+				),
77
+			)
78
+		);
79 79
 
80
-        return array(
81
-            'items_removed'  => (bool) $rows_updated,
82
-            'items_retained' => false, // always false in this example
83
-            'messages'       => array(),
84
-            'done'           => true,
85
-        );
86
-    }
80
+		return array(
81
+			'items_removed'  => (bool) $rows_updated,
82
+			'items_retained' => false, // always false in this example
83
+			'messages'       => array(),
84
+			'done'           => true,
85
+		);
86
+	}
87 87
 }
88 88
 // End of file EraseAttendeeData.php
89 89
 // Location: EventEspresso\core\domain\services\privacy\erasure/EraseAttendeeData.php
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Event_Related_Protected.strategy.php 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -17,89 +17,89 @@
 block discarded – undo
17 17
 class EE_Restriction_Generator_Event_Related_Protected extends EE_Restriction_Generator_Base
18 18
 {
19 19
 
20
-    /**
21
-     * Path to the event model from the model this restriction generator will be applied to;
22
-     * including the event model itself. Eg "Ticket.Datetime.Event"
23
-     * @var string
24
-     */
25
-    protected $_path_to_event_model = null;
20
+	/**
21
+	 * Path to the event model from the model this restriction generator will be applied to;
22
+	 * including the event model itself. Eg "Ticket.Datetime.Event"
23
+	 * @var string
24
+	 */
25
+	protected $_path_to_event_model = null;
26 26
 
27
-    /**
28
-     * Capability context on event model when creating restrictions.
29
-     * Eg, although we may want capability restrictions relating to deleting datetimes,
30
-     * they don't need to be able to DELETE EVENTS, they just need to be able to
31
-     * EDIT EVENTS in order to DELETE DATETIMES.
32
-     * @var string one of EEM_Base::valid_cap_contexts()
33
-     */
34
-    protected $_cap_context_on_event_model = null;
35
-    /**
36
-     *
37
-     * @param string $path_to_event_model
38
-     * @param string $cap_context_on_event_model  capability context on event model when creating restrictions.
39
-     * Eg, although we may want capability restrictions relating to deleting datetimes,
40
-     * they don't need to be able to DELETE EVENTS, they just need to be able to
41
-     * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same
42
-     * as on the primary model.
43
-     */
44
-    public function __construct($path_to_event_model, $cap_context_on_event_model = null)
45
-    {
46
-        if (substr($path_to_event_model, -1, 1) != '.') {
47
-            $path_to_event_model .= '.';
48
-        }
49
-        $this->_path_to_event_model = $path_to_event_model;
50
-        $this->_cap_context_on_event_model = $cap_context_on_event_model;
51
-    }
27
+	/**
28
+	 * Capability context on event model when creating restrictions.
29
+	 * Eg, although we may want capability restrictions relating to deleting datetimes,
30
+	 * they don't need to be able to DELETE EVENTS, they just need to be able to
31
+	 * EDIT EVENTS in order to DELETE DATETIMES.
32
+	 * @var string one of EEM_Base::valid_cap_contexts()
33
+	 */
34
+	protected $_cap_context_on_event_model = null;
35
+	/**
36
+	 *
37
+	 * @param string $path_to_event_model
38
+	 * @param string $cap_context_on_event_model  capability context on event model when creating restrictions.
39
+	 * Eg, although we may want capability restrictions relating to deleting datetimes,
40
+	 * they don't need to be able to DELETE EVENTS, they just need to be able to
41
+	 * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same
42
+	 * as on the primary model.
43
+	 */
44
+	public function __construct($path_to_event_model, $cap_context_on_event_model = null)
45
+	{
46
+		if (substr($path_to_event_model, -1, 1) != '.') {
47
+			$path_to_event_model .= '.';
48
+		}
49
+		$this->_path_to_event_model = $path_to_event_model;
50
+		$this->_cap_context_on_event_model = $cap_context_on_event_model;
51
+	}
52 52
 
53
-    /**
54
-     * Returns `$this->_cap_context_on_event_model`, the relevant action ("read",
55
-     * "read_admin", "edit" or "delete") for the EVENT related to this model.
56
-     * @see EE_Restriction_Generator_Event_Related_Protected::__construct()
57
-     * @return string one of EEM_Base::valid_cap_contexts()
58
-     */
59
-    protected function action_for_event()
60
-    {
61
-        if ($this->_cap_context_on_event_model) {
62
-            return $this->_cap_context_on_event_model;
63
-        } else {
64
-            return $this->action();
65
-        }
66
-    }
53
+	/**
54
+	 * Returns `$this->_cap_context_on_event_model`, the relevant action ("read",
55
+	 * "read_admin", "edit" or "delete") for the EVENT related to this model.
56
+	 * @see EE_Restriction_Generator_Event_Related_Protected::__construct()
57
+	 * @return string one of EEM_Base::valid_cap_contexts()
58
+	 */
59
+	protected function action_for_event()
60
+	{
61
+		if ($this->_cap_context_on_event_model) {
62
+			return $this->_cap_context_on_event_model;
63
+		} else {
64
+			return $this->action();
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     *
70
-     * @return \EE_Default_Where_Conditions
71
-     */
72
-    protected function _generate_restrictions()
73
-    {
74
-        // if there are no standard caps for this model, then for now all we know
75
-        // if they need the default cap to access this
76
-        if (! $this->model()->cap_slug()) {
77
-            return array(
78
-                self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
79
-            );
80
-        }
68
+	/**
69
+	 *
70
+	 * @return \EE_Default_Where_Conditions
71
+	 */
72
+	protected function _generate_restrictions()
73
+	{
74
+		// if there are no standard caps for this model, then for now all we know
75
+		// if they need the default cap to access this
76
+		if (! $this->model()->cap_slug()) {
77
+			return array(
78
+				self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
79
+			);
80
+		}
81 81
 
82
-        $event_model = EEM_Event::instance();
83
-        return array(
84
-            // first: basically access to non-defaults is essentially controlled by which events are accessible
85
-            // if they don't have the basic event cap, they can't access ANY non-default items
86
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event())              => new EE_Return_None_Where_Conditions(),
87
-            // if they don't have the others event cap, they can't access others' non-default items
88
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others')  => new EE_Default_Where_Conditions(
89
-                array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder )
90
-            ),
91
-            // if they have basic and others, but not private, they can't access others' private non-default items
92
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions(
93
-                array(
94
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions(
95
-                        array(
96
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
97
-                        ),
98
-                        false,
99
-                        $this->_path_to_event_model
100
-                    )
101
-                )
102
-            ),
103
-        );
104
-    }
82
+		$event_model = EEM_Event::instance();
83
+		return array(
84
+			// first: basically access to non-defaults is essentially controlled by which events are accessible
85
+			// if they don't have the basic event cap, they can't access ANY non-default items
86
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event())              => new EE_Return_None_Where_Conditions(),
87
+			// if they don't have the others event cap, they can't access others' non-default items
88
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others')  => new EE_Default_Where_Conditions(
89
+				array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder )
90
+			),
91
+			// if they have basic and others, but not private, they can't access others' private non-default items
92
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions(
93
+				array(
94
+					'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions(
95
+						array(
96
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
97
+						),
98
+						false,
99
+						$this->_path_to_event_model
100
+					)
101
+				)
102
+			),
103
+		);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         // if there are no standard caps for this model, then for now all we know
75 75
         // if they need the default cap to access this
76
-        if (! $this->model()->cap_slug()) {
76
+        if ( ! $this->model()->cap_slug()) {
77 77
             return array(
78 78
                 self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
79 79
             );
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
             // if they don't have the basic event cap, they can't access ANY non-default items
86 86
             EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event())              => new EE_Return_None_Where_Conditions(),
87 87
             // if they don't have the others event cap, they can't access others' non-default items
88
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others')  => new EE_Default_Where_Conditions(
89
-                array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder )
88
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_others')  => new EE_Default_Where_Conditions(
89
+                array($this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder)
90 90
             ),
91 91
             // if they have basic and others, but not private, they can't access others' private non-default items
92
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions(
92
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => new EE_Default_Where_Conditions(
93 93
                 array(
94
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions(
94
+                    'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => $this->addPublishedPostConditions(
95 95
                         array(
96
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
96
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
97 97
                         ),
98 98
                         false,
99 99
                         $this->_path_to_event_model
Please login to merge, or discard this patch.