Completed
Branch BUG/3575-event-deletion-previe... (bbeda1)
by
unknown
06:40 queued 04:49
created
core/services/shortcodes/ShortcodesManager.php 2 patches
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -29,210 +29,210 @@
 block discarded – undo
29 29
  */
30 30
 class ShortcodesManager
31 31
 {
32
-    /**
33
-     * @type CurrentPage
34
-     */
35
-    protected $current_page;
36
-
37
-    /**
38
-     * @var LegacyShortcodesManager $legacy_shortcodes_manager
39
-     */
40
-    private $legacy_shortcodes_manager;
41
-
42
-    /**
43
-     * @var ShortcodeInterface[] $shortcodes
44
-     */
45
-    private $shortcodes;
46
-
47
-
48
-    /**
49
-     * ShortcodesManager constructor
50
-     *
51
-     * @param LegacyShortcodesManager $legacy_shortcodes_manager
52
-     * @param CurrentPage             $current_page
53
-     */
54
-    public function __construct(LegacyShortcodesManager $legacy_shortcodes_manager, CurrentPage $current_page)
55
-    {
56
-        $this->legacy_shortcodes_manager = $legacy_shortcodes_manager;
57
-        $this->current_page              = $current_page;
58
-        // assemble a list of installed and active shortcodes
59
-        add_action(
60
-            'AHEE__EE_System__register_shortcodes_modules_and_widgets',
61
-            [$this, 'registerShortcodes'],
62
-            999
63
-        );
64
-        //  call add_shortcode() for all installed shortcodes
65
-        add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'addShortcodes']);
66
-        // check content for shortcodes the old way
67
-        add_action('parse_query', [$this->legacy_shortcodes_manager, 'initializeShortcodes'], 5);
68
-        // check content for shortcodes the NEW more efficient way
69
-        add_action('template_redirect', [$this, 'templateRedirect'], 999);
70
-    }
71
-
72
-
73
-    /**
74
-     * @return CollectionInterface|ShortcodeInterface[]
75
-     * @throws InvalidIdentifierException
76
-     * @throws InvalidInterfaceException
77
-     * @throws InvalidFilePathException
78
-     * @throws InvalidEntityException
79
-     * @throws InvalidDataTypeException
80
-     * @throws InvalidClassException
81
-     */
82
-    public function getShortcodes()
83
-    {
84
-        if (! $this->shortcodes instanceof CollectionInterface) {
85
-            $this->shortcodes = $this->loadShortcodesCollection();
86
-        }
87
-        return $this->shortcodes;
88
-    }
89
-
90
-
91
-    /**
92
-     * @return CollectionInterface|ShortcodeInterface[]
93
-     * @throws InvalidIdentifierException
94
-     * @throws InvalidInterfaceException
95
-     * @throws InvalidFilePathException
96
-     * @throws InvalidEntityException
97
-     * @throws InvalidDataTypeException
98
-     * @throws InvalidClassException
99
-     */
100
-    protected function loadShortcodesCollection()
101
-    {
102
-        $loader = new CollectionLoader(
103
-            new CollectionDetails(
104
-            // collection name
105
-                'shortcodes',
106
-                // collection interface
107
-                'EventEspresso\core\services\shortcodes\ShortcodeInterface',
108
-                // FQCNs for classes to add (all classes within that namespace will be loaded)
109
-                ['EventEspresso\core\domain\entities\shortcodes'],
110
-                // filepaths to classes to add
111
-                [],
112
-                // file mask to use if parsing folder for files to add
113
-                '',
114
-                // what to use as identifier for collection entities
115
-                // using CLASS NAME prevents duplicates (works like a singleton)
116
-                CollectionDetails::ID_CLASS_NAME
117
-            )
118
-        );
119
-        return $loader->getCollection();
120
-    }
121
-
122
-
123
-    /**
124
-     * @return void
125
-     * @throws DomainException
126
-     * @throws InvalidInterfaceException
127
-     * @throws InvalidIdentifierException
128
-     * @throws InvalidFilePathException
129
-     * @throws InvalidEntityException
130
-     * @throws InvalidDataTypeException
131
-     * @throws InvalidClassException
132
-     * @throws Exception
133
-     */
134
-    public function registerShortcodes()
135
-    {
136
-        try {
137
-            $this->shortcodes = apply_filters(
138
-                'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
139
-                $this->getShortcodes()
140
-            );
141
-            if (! $this->shortcodes instanceof CollectionInterface) {
142
-                throw new InvalidEntityException(
143
-                    $this->shortcodes,
144
-                    'CollectionInterface',
145
-                    sprintf(
146
-                        esc_html__(
147
-                            'The "FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection" filter must return a Collection of EspressoShortcode objects. "%1$s" was received instead.',
148
-                            'event_espresso'
149
-                        ),
150
-                        is_object($this->shortcodes) ? get_class($this->shortcodes) : gettype($this->shortcodes)
151
-                    )
152
-                );
153
-            }
154
-            $this->legacy_shortcodes_manager->registerShortcodes();
155
-        } catch (Exception $exception) {
156
-            new ExceptionStackTraceDisplay($exception);
157
-        }
158
-    }
159
-
160
-
161
-    /**
162
-     * @return void
163
-     * @throws Exception
164
-     */
165
-    public function addShortcodes()
166
-    {
167
-        try {
168
-            // cycle thru shortcode folders
169
-            foreach ($this->shortcodes as $shortcode) {
170
-                if ($shortcode instanceof EnqueueAssetsInterface) {
171
-                    add_action('wp_enqueue_scripts', [$shortcode, 'registerScriptsAndStylesheets'], 10);
172
-                    add_action('wp_enqueue_scripts', [$shortcode, 'enqueueStylesheets'], 11);
173
-                }
174
-                // add_shortcode() if it has not already been added
175
-                if (! shortcode_exists($shortcode->getTag())) {
176
-                    add_shortcode($shortcode->getTag(), [$shortcode, 'processShortcodeCallback']);
177
-                }
178
-            }
179
-            $this->legacy_shortcodes_manager->addShortcodes();
180
-        } catch (Exception $exception) {
181
-            new ExceptionStackTraceDisplay($exception);
182
-        }
183
-    }
184
-
185
-
186
-    /**
187
-     * callback for the "template_redirect" hook point
188
-     * checks posts for EE shortcodes, and initializes them,
189
-     * then toggles filter switch that loads core default assets
190
-     *
191
-     * @return void
192
-     */
193
-    public function templateRedirect()
194
-    {
195
-        global $wp_query;
196
-        if (empty($wp_query->posts)) {
197
-            return;
198
-        }
199
-        $load_assets = false;
200
-        // array of posts displayed in current request
201
-        $posts = is_array($wp_query->posts) ? $wp_query->posts : [$wp_query->posts];
202
-        foreach ($posts as $post) {
203
-            // now check post content and excerpt for EE shortcodes
204
-            $load_assets = $this->parseContentForShortcodes($post->post_content)
205
-                ? true
206
-                : $load_assets;
207
-        }
208
-        if ($load_assets) {
209
-            $this->current_page->setEspressoPage(true);
210
-            add_filter('FHEE_load_css', '__return_true');
211
-            add_filter('FHEE_load_js', '__return_true');
212
-        }
213
-    }
214
-
215
-
216
-    /**
217
-     * checks supplied content against list of shortcodes,
218
-     * then initializes any found shortcodes, and returns true.
219
-     * returns false if no shortcodes found.
220
-     *
221
-     * @param string $content
222
-     * @return bool
223
-     */
224
-    public function parseContentForShortcodes($content)
225
-    {
226
-        $has_shortcode = false;
227
-        if (empty($this->shortcodes)) {
228
-            return $has_shortcode;
229
-        }
230
-        foreach ($this->shortcodes as $shortcode) {
231
-            if (has_shortcode($content, $shortcode->getTag())) {
232
-                $shortcode->initializeShortcode();
233
-                $has_shortcode = true;
234
-            }
235
-        }
236
-        return $has_shortcode;
237
-    }
32
+	/**
33
+	 * @type CurrentPage
34
+	 */
35
+	protected $current_page;
36
+
37
+	/**
38
+	 * @var LegacyShortcodesManager $legacy_shortcodes_manager
39
+	 */
40
+	private $legacy_shortcodes_manager;
41
+
42
+	/**
43
+	 * @var ShortcodeInterface[] $shortcodes
44
+	 */
45
+	private $shortcodes;
46
+
47
+
48
+	/**
49
+	 * ShortcodesManager constructor
50
+	 *
51
+	 * @param LegacyShortcodesManager $legacy_shortcodes_manager
52
+	 * @param CurrentPage             $current_page
53
+	 */
54
+	public function __construct(LegacyShortcodesManager $legacy_shortcodes_manager, CurrentPage $current_page)
55
+	{
56
+		$this->legacy_shortcodes_manager = $legacy_shortcodes_manager;
57
+		$this->current_page              = $current_page;
58
+		// assemble a list of installed and active shortcodes
59
+		add_action(
60
+			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
61
+			[$this, 'registerShortcodes'],
62
+			999
63
+		);
64
+		//  call add_shortcode() for all installed shortcodes
65
+		add_action('AHEE__EE_System__core_loaded_and_ready', [$this, 'addShortcodes']);
66
+		// check content for shortcodes the old way
67
+		add_action('parse_query', [$this->legacy_shortcodes_manager, 'initializeShortcodes'], 5);
68
+		// check content for shortcodes the NEW more efficient way
69
+		add_action('template_redirect', [$this, 'templateRedirect'], 999);
70
+	}
71
+
72
+
73
+	/**
74
+	 * @return CollectionInterface|ShortcodeInterface[]
75
+	 * @throws InvalidIdentifierException
76
+	 * @throws InvalidInterfaceException
77
+	 * @throws InvalidFilePathException
78
+	 * @throws InvalidEntityException
79
+	 * @throws InvalidDataTypeException
80
+	 * @throws InvalidClassException
81
+	 */
82
+	public function getShortcodes()
83
+	{
84
+		if (! $this->shortcodes instanceof CollectionInterface) {
85
+			$this->shortcodes = $this->loadShortcodesCollection();
86
+		}
87
+		return $this->shortcodes;
88
+	}
89
+
90
+
91
+	/**
92
+	 * @return CollectionInterface|ShortcodeInterface[]
93
+	 * @throws InvalidIdentifierException
94
+	 * @throws InvalidInterfaceException
95
+	 * @throws InvalidFilePathException
96
+	 * @throws InvalidEntityException
97
+	 * @throws InvalidDataTypeException
98
+	 * @throws InvalidClassException
99
+	 */
100
+	protected function loadShortcodesCollection()
101
+	{
102
+		$loader = new CollectionLoader(
103
+			new CollectionDetails(
104
+			// collection name
105
+				'shortcodes',
106
+				// collection interface
107
+				'EventEspresso\core\services\shortcodes\ShortcodeInterface',
108
+				// FQCNs for classes to add (all classes within that namespace will be loaded)
109
+				['EventEspresso\core\domain\entities\shortcodes'],
110
+				// filepaths to classes to add
111
+				[],
112
+				// file mask to use if parsing folder for files to add
113
+				'',
114
+				// what to use as identifier for collection entities
115
+				// using CLASS NAME prevents duplicates (works like a singleton)
116
+				CollectionDetails::ID_CLASS_NAME
117
+			)
118
+		);
119
+		return $loader->getCollection();
120
+	}
121
+
122
+
123
+	/**
124
+	 * @return void
125
+	 * @throws DomainException
126
+	 * @throws InvalidInterfaceException
127
+	 * @throws InvalidIdentifierException
128
+	 * @throws InvalidFilePathException
129
+	 * @throws InvalidEntityException
130
+	 * @throws InvalidDataTypeException
131
+	 * @throws InvalidClassException
132
+	 * @throws Exception
133
+	 */
134
+	public function registerShortcodes()
135
+	{
136
+		try {
137
+			$this->shortcodes = apply_filters(
138
+				'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
139
+				$this->getShortcodes()
140
+			);
141
+			if (! $this->shortcodes instanceof CollectionInterface) {
142
+				throw new InvalidEntityException(
143
+					$this->shortcodes,
144
+					'CollectionInterface',
145
+					sprintf(
146
+						esc_html__(
147
+							'The "FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection" filter must return a Collection of EspressoShortcode objects. "%1$s" was received instead.',
148
+							'event_espresso'
149
+						),
150
+						is_object($this->shortcodes) ? get_class($this->shortcodes) : gettype($this->shortcodes)
151
+					)
152
+				);
153
+			}
154
+			$this->legacy_shortcodes_manager->registerShortcodes();
155
+		} catch (Exception $exception) {
156
+			new ExceptionStackTraceDisplay($exception);
157
+		}
158
+	}
159
+
160
+
161
+	/**
162
+	 * @return void
163
+	 * @throws Exception
164
+	 */
165
+	public function addShortcodes()
166
+	{
167
+		try {
168
+			// cycle thru shortcode folders
169
+			foreach ($this->shortcodes as $shortcode) {
170
+				if ($shortcode instanceof EnqueueAssetsInterface) {
171
+					add_action('wp_enqueue_scripts', [$shortcode, 'registerScriptsAndStylesheets'], 10);
172
+					add_action('wp_enqueue_scripts', [$shortcode, 'enqueueStylesheets'], 11);
173
+				}
174
+				// add_shortcode() if it has not already been added
175
+				if (! shortcode_exists($shortcode->getTag())) {
176
+					add_shortcode($shortcode->getTag(), [$shortcode, 'processShortcodeCallback']);
177
+				}
178
+			}
179
+			$this->legacy_shortcodes_manager->addShortcodes();
180
+		} catch (Exception $exception) {
181
+			new ExceptionStackTraceDisplay($exception);
182
+		}
183
+	}
184
+
185
+
186
+	/**
187
+	 * callback for the "template_redirect" hook point
188
+	 * checks posts for EE shortcodes, and initializes them,
189
+	 * then toggles filter switch that loads core default assets
190
+	 *
191
+	 * @return void
192
+	 */
193
+	public function templateRedirect()
194
+	{
195
+		global $wp_query;
196
+		if (empty($wp_query->posts)) {
197
+			return;
198
+		}
199
+		$load_assets = false;
200
+		// array of posts displayed in current request
201
+		$posts = is_array($wp_query->posts) ? $wp_query->posts : [$wp_query->posts];
202
+		foreach ($posts as $post) {
203
+			// now check post content and excerpt for EE shortcodes
204
+			$load_assets = $this->parseContentForShortcodes($post->post_content)
205
+				? true
206
+				: $load_assets;
207
+		}
208
+		if ($load_assets) {
209
+			$this->current_page->setEspressoPage(true);
210
+			add_filter('FHEE_load_css', '__return_true');
211
+			add_filter('FHEE_load_js', '__return_true');
212
+		}
213
+	}
214
+
215
+
216
+	/**
217
+	 * checks supplied content against list of shortcodes,
218
+	 * then initializes any found shortcodes, and returns true.
219
+	 * returns false if no shortcodes found.
220
+	 *
221
+	 * @param string $content
222
+	 * @return bool
223
+	 */
224
+	public function parseContentForShortcodes($content)
225
+	{
226
+		$has_shortcode = false;
227
+		if (empty($this->shortcodes)) {
228
+			return $has_shortcode;
229
+		}
230
+		foreach ($this->shortcodes as $shortcode) {
231
+			if (has_shortcode($content, $shortcode->getTag())) {
232
+				$shortcode->initializeShortcode();
233
+				$has_shortcode = true;
234
+			}
235
+		}
236
+		return $has_shortcode;
237
+	}
238 238
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function getShortcodes()
83 83
     {
84
-        if (! $this->shortcodes instanceof CollectionInterface) {
84
+        if ( ! $this->shortcodes instanceof CollectionInterface) {
85 85
             $this->shortcodes = $this->loadShortcodesCollection();
86 86
         }
87 87
         return $this->shortcodes;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
139 139
                 $this->getShortcodes()
140 140
             );
141
-            if (! $this->shortcodes instanceof CollectionInterface) {
141
+            if ( ! $this->shortcodes instanceof CollectionInterface) {
142 142
                 throw new InvalidEntityException(
143 143
                     $this->shortcodes,
144 144
                     'CollectionInterface',
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                     add_action('wp_enqueue_scripts', [$shortcode, 'enqueueStylesheets'], 11);
173 173
                 }
174 174
                 // add_shortcode() if it has not already been added
175
-                if (! shortcode_exists($shortcode->getTag())) {
175
+                if ( ! shortcode_exists($shortcode->getTag())) {
176 176
                     add_shortcode($shortcode->getTag(), [$shortcode, 'processShortcodeCallback']);
177 177
                 }
178 178
             }
Please login to merge, or discard this patch.
core/libraries/iframe_display/Iframe.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function __construct($title, $content)
84 84
     {
85 85
         global $wp_version;
86
-        if (! defined('EE_IFRAME_DIR_URL')) {
86
+        if ( ! defined('EE_IFRAME_DIR_URL')) {
87 87
             define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
88 88
         }
89 89
         $this->setContent($content);
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
                 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
94 94
                 array(
95 95
                     'site_theme'       => get_stylesheet_directory_uri()
96
-                                          . '/style.css?ver=' . EVENT_ESPRESSO_VERSION,
97
-                    'dashicons'        => includes_url('css/dashicons.min.css?ver=' . $wp_version),
96
+                                          . '/style.css?ver='.EVENT_ESPRESSO_VERSION,
97
+                    'dashicons'        => includes_url('css/dashicons.min.css?ver='.$wp_version),
98 98
                     'espresso_default' => EE_GLOBAL_ASSETS_URL
99
-                                          . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
99
+                                          . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION,
100 100
                 ),
101 101
                 $this
102 102
             )
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
             apply_filters(
106 106
                 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
107 107
                 array(
108
-                    'jquery'        => includes_url('js/jquery/jquery.js?ver=' . $wp_version),
108
+                    'jquery'        => includes_url('js/jquery/jquery.js?ver='.$wp_version),
109 109
                     'espresso_core' => EE_GLOBAL_ASSETS_URL
110
-                                       . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
110
+                                       . 'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
111 111
                 ),
112 112
                 $this
113 113
             )
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             );
182 182
         }
183 183
         foreach ($stylesheets as $handle => $stylesheet) {
184
-            $this->css[ $handle ] = $stylesheet;
184
+            $this->css[$handle] = $stylesheet;
185 185
         }
186 186
     }
187 187
 
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
         }
204 204
         foreach ($scripts as $handle => $script) {
205 205
             if ($add_to_header) {
206
-                $this->header_js[ $handle ] = $script;
206
+                $this->header_js[$handle] = $script;
207 207
             } else {
208
-                $this->footer_js[ $handle ] = $script;
208
+                $this->footer_js[$handle] = $script;
209 209
             }
210 210
         }
211 211
     }
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
         }
229 229
         foreach ($script_attributes as $handle => $script_attribute) {
230 230
             if ($add_to_header) {
231
-                $this->header_js_attributes[ $handle ] = $script_attribute;
231
+                $this->header_js_attributes[$handle] = $script_attribute;
232 232
             } else {
233
-                $this->footer_js_attributes[ $handle ] = $script_attribute;
233
+                $this->footer_js_attributes[$handle] = $script_attribute;
234 234
             }
235 235
         }
236 236
     }
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
         }
254 254
         foreach ($vars as $handle => $var) {
255 255
             if ($var_name === 'eei18n') {
256
-                EE_Registry::$i18n_js_strings[ $handle ] = $var;
256
+                EE_Registry::$i18n_js_strings[$handle] = $var;
257 257
             } elseif ($var_name === 'eeCAL' && $handle === 'espresso_calendar') {
258
-                $this->localized_vars[ $var_name ] = $var;
258
+                $this->localized_vars[$var_name] = $var;
259 259
             } else {
260
-                if (! isset($this->localized_vars[ $var_name ])) {
261
-                    $this->localized_vars[ $var_name ] = array();
260
+                if ( ! isset($this->localized_vars[$var_name])) {
261
+                    $this->localized_vars[$var_name] = array();
262 262
                 }
263
-                $this->localized_vars[ $var_name ][ $handle ] = $var;
263
+                $this->localized_vars[$var_name][$handle] = $var;
264 264
             }
265 265
         }
266 266
     }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     public function getTemplate()
291 291
     {
292 292
         return EEH_Template::display_template(
293
-            __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php',
293
+            __DIR__.DIRECTORY_SEPARATOR.'iframe_wrapper.template.php',
294 294
             array(
295 295
                 'title'                => apply_filters(
296 296
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
                 ),
335 335
                 'eei18n'               => apply_filters(
336 336
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
337
-                    EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars(),
337
+                    EE_Registry::localize_i18n_js_strings().$this->localizeJsonVars(),
338 338
                     $this
339 339
                 ),
340 340
                 'notices'              => EEH_Template::display_template(
341
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
341
+                    EE_TEMPLATES.'espresso-ajax-notices.template.php',
342 342
                     array(),
343 343
                     true
344 344
                 ),
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
     {
359 359
         $JSON = '';
360 360
         foreach ($this->localized_vars as $var_name => $vars) {
361
-            $this->localized_vars[ $var_name ] = $this->encodeJsonVars($vars);
361
+            $this->localized_vars[$var_name] = $this->encodeJsonVars($vars);
362 362
             $JSON .= "/* <![CDATA[ */ var {$var_name} = ";
363
-            $JSON .= wp_json_encode($this->localized_vars[ $var_name ]);
363
+            $JSON .= wp_json_encode($this->localized_vars[$var_name]);
364 364
             $JSON .= '; /* ]]> */';
365 365
         }
366 366
         return $JSON;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         if (is_array($var)) {
377 377
             $localized_vars = array();
378 378
             foreach ((array) $var as $key => $value) {
379
-                $localized_vars[ $key ] = $this->encodeJsonVars($value);
379
+                $localized_vars[$key] = $this->encodeJsonVars($value);
380 380
             }
381 381
             return $localized_vars;
382 382
         }
Please login to merge, or discard this patch.
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -18,373 +18,373 @@
 block discarded – undo
18 18
 class Iframe
19 19
 {
20 20
 
21
-    /*
21
+	/*
22 22
     * HTML for notices and ajax gif
23 23
     * @var string $title
24 24
     */
25
-    protected $title = '';
25
+	protected $title = '';
26 26
 
27
-    /*
27
+	/*
28 28
     * HTML for the content being displayed
29 29
     * @var string $content
30 30
     */
31
-    protected $content = '';
31
+	protected $content = '';
32 32
 
33
-    /*
33
+	/*
34 34
     * whether or not to call wp_head() and wp_footer()
35 35
     * @var boolean $enqueue_wp_assets
36 36
     */
37
-    protected $enqueue_wp_assets = false;
37
+	protected $enqueue_wp_assets = false;
38 38
 
39
-    /*
39
+	/*
40 40
     * an array of CSS URLs
41 41
     * @var array $css
42 42
     */
43
-    protected $css = array();
43
+	protected $css = array();
44 44
 
45
-    /*
45
+	/*
46 46
     * an array of JS URLs to be set in the HTML header.
47 47
     * @var array $header_js
48 48
     */
49
-    protected $header_js = array();
49
+	protected $header_js = array();
50 50
 
51
-    /*
51
+	/*
52 52
     * an array of additional attributes to be added to <script> tags for header JS
53 53
     * @var array $footer_js
54 54
     */
55
-    protected $header_js_attributes = array();
55
+	protected $header_js_attributes = array();
56 56
 
57
-    /*
57
+	/*
58 58
     * an array of JS URLs to be displayed before the HTML </body> tag
59 59
     * @var array $footer_js
60 60
     */
61
-    protected $footer_js = array();
61
+	protected $footer_js = array();
62 62
 
63
-    /*
63
+	/*
64 64
     * an array of additional attributes to be added to <script> tags for footer JS
65 65
     * @var array $footer_js_attributes
66 66
     */
67
-    protected $footer_js_attributes = array();
67
+	protected $footer_js_attributes = array();
68 68
 
69
-    /*
69
+	/*
70 70
     * an array of JSON vars to be set in the HTML header.
71 71
     * @var array $localized_vars
72 72
     */
73
-    protected $localized_vars = array();
74
-
75
-
76
-    /**
77
-     * Iframe constructor
78
-     *
79
-     * @param string $title
80
-     * @param string $content
81
-     * @throws DomainException
82
-     */
83
-    public function __construct($title, $content)
84
-    {
85
-        global $wp_version;
86
-        if (! defined('EE_IFRAME_DIR_URL')) {
87
-            define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
88
-        }
89
-        $this->setContent($content);
90
-        $this->setTitle($title);
91
-        $this->addStylesheets(
92
-            apply_filters(
93
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
94
-                array(
95
-                    'site_theme'       => get_stylesheet_directory_uri()
96
-                                          . '/style.css?ver=' . EVENT_ESPRESSO_VERSION,
97
-                    'dashicons'        => includes_url('css/dashicons.min.css?ver=' . $wp_version),
98
-                    'espresso_default' => EE_GLOBAL_ASSETS_URL
99
-                                          . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
100
-                ),
101
-                $this
102
-            )
103
-        );
104
-        $this->addScripts(
105
-            apply_filters(
106
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
107
-                array(
108
-                    'jquery'        => includes_url('js/jquery/jquery.js?ver=' . $wp_version),
109
-                    'espresso_core' => EE_GLOBAL_ASSETS_URL
110
-                                       . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
111
-                ),
112
-                $this
113
-            )
114
-        );
115
-        if (
116
-            apply_filters(
117
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__load_default_theme_stylesheet',
118
-                false
119
-            )
120
-        ) {
121
-            $this->addStylesheets(
122
-                apply_filters(
123
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_theme_stylesheet',
124
-                    array('default_theme_stylesheet' => get_stylesheet_uri()),
125
-                    $this
126
-                )
127
-            );
128
-        }
129
-    }
130
-
131
-
132
-    /**
133
-     * @param string $title
134
-     * @throws DomainException
135
-     */
136
-    public function setTitle($title)
137
-    {
138
-        if (empty($title)) {
139
-            throw new DomainException(
140
-                esc_html__('You must provide a page title in order to create an iframe.', 'event_espresso')
141
-            );
142
-        }
143
-        $this->title = $title;
144
-    }
145
-
146
-
147
-    /**
148
-     * @param string $content
149
-     * @throws DomainException
150
-     */
151
-    public function setContent($content)
152
-    {
153
-        if (empty($content)) {
154
-            throw new DomainException(
155
-                esc_html__('You must provide content in order to create an iframe.', 'event_espresso')
156
-            );
157
-        }
158
-        $this->content = $content;
159
-    }
160
-
161
-
162
-    /**
163
-     * @param boolean $enqueue_wp_assets
164
-     */
165
-    public function setEnqueueWpAssets($enqueue_wp_assets)
166
-    {
167
-        $this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN);
168
-    }
169
-
170
-
171
-    /**
172
-     * @param array $stylesheets
173
-     * @throws DomainException
174
-     */
175
-    public function addStylesheets(array $stylesheets)
176
-    {
177
-        if (empty($stylesheets)) {
178
-            throw new DomainException(
179
-                esc_html__(
180
-                    'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
181
-                    'event_espresso'
182
-                )
183
-            );
184
-        }
185
-        foreach ($stylesheets as $handle => $stylesheet) {
186
-            $this->css[ $handle ] = $stylesheet;
187
-        }
188
-    }
189
-
190
-
191
-    /**
192
-     * @param array $scripts
193
-     * @param bool  $add_to_header
194
-     * @throws DomainException
195
-     */
196
-    public function addScripts(array $scripts, $add_to_header = false)
197
-    {
198
-        if (empty($scripts)) {
199
-            throw new DomainException(
200
-                esc_html__(
201
-                    'A non-empty array of URLs, is required to add Javascript to an iframe.',
202
-                    'event_espresso'
203
-                )
204
-            );
205
-        }
206
-        foreach ($scripts as $handle => $script) {
207
-            if ($add_to_header) {
208
-                $this->header_js[ $handle ] = $script;
209
-            } else {
210
-                $this->footer_js[ $handle ] = $script;
211
-            }
212
-        }
213
-    }
214
-
215
-
216
-    /**
217
-     * @param array $script_attributes
218
-     * @param bool  $add_to_header
219
-     * @throws DomainException
220
-     */
221
-    public function addScriptAttributes(array $script_attributes, $add_to_header = false)
222
-    {
223
-        if (empty($script_attributes)) {
224
-            throw new DomainException(
225
-                esc_html__(
226
-                    'A non-empty array of strings, is required to add attributes to iframe Javascript.',
227
-                    'event_espresso'
228
-                )
229
-            );
230
-        }
231
-        foreach ($script_attributes as $handle => $script_attribute) {
232
-            if ($add_to_header) {
233
-                $this->header_js_attributes[ $handle ] = $script_attribute;
234
-            } else {
235
-                $this->footer_js_attributes[ $handle ] = $script_attribute;
236
-            }
237
-        }
238
-    }
239
-
240
-
241
-    /**
242
-     * @param array  $vars
243
-     * @param string $var_name
244
-     * @throws DomainException
245
-     */
246
-    public function addLocalizedVars(array $vars, $var_name = 'eei18n')
247
-    {
248
-        if (empty($vars)) {
249
-            throw new DomainException(
250
-                esc_html__(
251
-                    'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
252
-                    'event_espresso'
253
-                )
254
-            );
255
-        }
256
-        foreach ($vars as $handle => $var) {
257
-            if ($var_name === 'eei18n') {
258
-                EE_Registry::$i18n_js_strings[ $handle ] = $var;
259
-            } elseif ($var_name === 'eeCAL' && $handle === 'espresso_calendar') {
260
-                $this->localized_vars[ $var_name ] = $var;
261
-            } else {
262
-                if (! isset($this->localized_vars[ $var_name ])) {
263
-                    $this->localized_vars[ $var_name ] = array();
264
-                }
265
-                $this->localized_vars[ $var_name ][ $handle ] = $var;
266
-            }
267
-        }
268
-    }
269
-
270
-
271
-    /**
272
-     * @param string $utm_content
273
-     * @throws DomainException
274
-     */
275
-    public function display($utm_content = '')
276
-    {
277
-        $this->content .= EEH_Template::powered_by_event_espresso(
278
-            '',
279
-            '',
280
-            ! empty($utm_content) ? array('utm_content' => $utm_content) : array()
281
-        );
282
-        EE_System::do_not_cache();
283
-        echo $this->getTemplate(); // already escaped
284
-        exit;
285
-    }
286
-
287
-
288
-    /**
289
-     * @return string
290
-     * @throws DomainException
291
-     */
292
-    public function getTemplate()
293
-    {
294
-        return EEH_Template::display_template(
295
-            __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php',
296
-            array(
297
-                'title'                => apply_filters(
298
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
299
-                    $this->title,
300
-                    $this
301
-                ),
302
-                'content'              => apply_filters(
303
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content',
304
-                    $this->content,
305
-                    $this
306
-                ),
307
-                'enqueue_wp_assets'    => apply_filters(
308
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
309
-                    $this->enqueue_wp_assets,
310
-                    $this
311
-                ),
312
-                'css'                  => (array) apply_filters(
313
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
314
-                    $this->css,
315
-                    $this
316
-                ),
317
-                'header_js'            => (array) apply_filters(
318
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
319
-                    $this->header_js,
320
-                    $this
321
-                ),
322
-                'header_js_attributes' => (array) apply_filters(
323
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_attributes',
324
-                    $this->header_js_attributes,
325
-                    $this
326
-                ),
327
-                'footer_js'            => (array) apply_filters(
328
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
329
-                    $this->footer_js,
330
-                    $this
331
-                ),
332
-                'footer_js_attributes' => (array) apply_filters(
333
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_attributes',
334
-                    $this->footer_js_attributes,
335
-                    $this
336
-                ),
337
-                'eei18n'               => apply_filters(
338
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
339
-                    EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars(),
340
-                    $this
341
-                ),
342
-                'notices'              => EEH_Template::display_template(
343
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
344
-                    array(),
345
-                    true
346
-                ),
347
-            ),
348
-            true,
349
-            true
350
-        );
351
-    }
352
-
353
-
354
-    /**
355
-     * localizeJsonVars
356
-     *
357
-     * @return string
358
-     */
359
-    public function localizeJsonVars()
360
-    {
361
-        $JSON = '';
362
-        foreach ($this->localized_vars as $var_name => $vars) {
363
-            $this->localized_vars[ $var_name ] = $this->encodeJsonVars($vars);
364
-            $JSON .= "/* <![CDATA[ */ var {$var_name} = ";
365
-            $JSON .= wp_json_encode($this->localized_vars[ $var_name ]);
366
-            $JSON .= '; /* ]]> */';
367
-        }
368
-        return $JSON;
369
-    }
370
-
371
-
372
-    /**
373
-     * @param bool|int|float|string|array $var
374
-     * @return array|string|null
375
-     */
376
-    public function encodeJsonVars($var)
377
-    {
378
-        if (is_array($var)) {
379
-            $localized_vars = array();
380
-            foreach ((array) $var as $key => $value) {
381
-                $localized_vars[ $key ] = $this->encodeJsonVars($value);
382
-            }
383
-            return $localized_vars;
384
-        }
385
-        if (is_scalar($var)) {
386
-            return html_entity_decode((string) $var, ENT_QUOTES, 'UTF-8');
387
-        }
388
-        return null;
389
-    }
73
+	protected $localized_vars = array();
74
+
75
+
76
+	/**
77
+	 * Iframe constructor
78
+	 *
79
+	 * @param string $title
80
+	 * @param string $content
81
+	 * @throws DomainException
82
+	 */
83
+	public function __construct($title, $content)
84
+	{
85
+		global $wp_version;
86
+		if (! defined('EE_IFRAME_DIR_URL')) {
87
+			define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
88
+		}
89
+		$this->setContent($content);
90
+		$this->setTitle($title);
91
+		$this->addStylesheets(
92
+			apply_filters(
93
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
94
+				array(
95
+					'site_theme'       => get_stylesheet_directory_uri()
96
+										  . '/style.css?ver=' . EVENT_ESPRESSO_VERSION,
97
+					'dashicons'        => includes_url('css/dashicons.min.css?ver=' . $wp_version),
98
+					'espresso_default' => EE_GLOBAL_ASSETS_URL
99
+										  . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
100
+				),
101
+				$this
102
+			)
103
+		);
104
+		$this->addScripts(
105
+			apply_filters(
106
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
107
+				array(
108
+					'jquery'        => includes_url('js/jquery/jquery.js?ver=' . $wp_version),
109
+					'espresso_core' => EE_GLOBAL_ASSETS_URL
110
+									   . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
111
+				),
112
+				$this
113
+			)
114
+		);
115
+		if (
116
+			apply_filters(
117
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__load_default_theme_stylesheet',
118
+				false
119
+			)
120
+		) {
121
+			$this->addStylesheets(
122
+				apply_filters(
123
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_theme_stylesheet',
124
+					array('default_theme_stylesheet' => get_stylesheet_uri()),
125
+					$this
126
+				)
127
+			);
128
+		}
129
+	}
130
+
131
+
132
+	/**
133
+	 * @param string $title
134
+	 * @throws DomainException
135
+	 */
136
+	public function setTitle($title)
137
+	{
138
+		if (empty($title)) {
139
+			throw new DomainException(
140
+				esc_html__('You must provide a page title in order to create an iframe.', 'event_espresso')
141
+			);
142
+		}
143
+		$this->title = $title;
144
+	}
145
+
146
+
147
+	/**
148
+	 * @param string $content
149
+	 * @throws DomainException
150
+	 */
151
+	public function setContent($content)
152
+	{
153
+		if (empty($content)) {
154
+			throw new DomainException(
155
+				esc_html__('You must provide content in order to create an iframe.', 'event_espresso')
156
+			);
157
+		}
158
+		$this->content = $content;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param boolean $enqueue_wp_assets
164
+	 */
165
+	public function setEnqueueWpAssets($enqueue_wp_assets)
166
+	{
167
+		$this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN);
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param array $stylesheets
173
+	 * @throws DomainException
174
+	 */
175
+	public function addStylesheets(array $stylesheets)
176
+	{
177
+		if (empty($stylesheets)) {
178
+			throw new DomainException(
179
+				esc_html__(
180
+					'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
181
+					'event_espresso'
182
+				)
183
+			);
184
+		}
185
+		foreach ($stylesheets as $handle => $stylesheet) {
186
+			$this->css[ $handle ] = $stylesheet;
187
+		}
188
+	}
189
+
190
+
191
+	/**
192
+	 * @param array $scripts
193
+	 * @param bool  $add_to_header
194
+	 * @throws DomainException
195
+	 */
196
+	public function addScripts(array $scripts, $add_to_header = false)
197
+	{
198
+		if (empty($scripts)) {
199
+			throw new DomainException(
200
+				esc_html__(
201
+					'A non-empty array of URLs, is required to add Javascript to an iframe.',
202
+					'event_espresso'
203
+				)
204
+			);
205
+		}
206
+		foreach ($scripts as $handle => $script) {
207
+			if ($add_to_header) {
208
+				$this->header_js[ $handle ] = $script;
209
+			} else {
210
+				$this->footer_js[ $handle ] = $script;
211
+			}
212
+		}
213
+	}
214
+
215
+
216
+	/**
217
+	 * @param array $script_attributes
218
+	 * @param bool  $add_to_header
219
+	 * @throws DomainException
220
+	 */
221
+	public function addScriptAttributes(array $script_attributes, $add_to_header = false)
222
+	{
223
+		if (empty($script_attributes)) {
224
+			throw new DomainException(
225
+				esc_html__(
226
+					'A non-empty array of strings, is required to add attributes to iframe Javascript.',
227
+					'event_espresso'
228
+				)
229
+			);
230
+		}
231
+		foreach ($script_attributes as $handle => $script_attribute) {
232
+			if ($add_to_header) {
233
+				$this->header_js_attributes[ $handle ] = $script_attribute;
234
+			} else {
235
+				$this->footer_js_attributes[ $handle ] = $script_attribute;
236
+			}
237
+		}
238
+	}
239
+
240
+
241
+	/**
242
+	 * @param array  $vars
243
+	 * @param string $var_name
244
+	 * @throws DomainException
245
+	 */
246
+	public function addLocalizedVars(array $vars, $var_name = 'eei18n')
247
+	{
248
+		if (empty($vars)) {
249
+			throw new DomainException(
250
+				esc_html__(
251
+					'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
252
+					'event_espresso'
253
+				)
254
+			);
255
+		}
256
+		foreach ($vars as $handle => $var) {
257
+			if ($var_name === 'eei18n') {
258
+				EE_Registry::$i18n_js_strings[ $handle ] = $var;
259
+			} elseif ($var_name === 'eeCAL' && $handle === 'espresso_calendar') {
260
+				$this->localized_vars[ $var_name ] = $var;
261
+			} else {
262
+				if (! isset($this->localized_vars[ $var_name ])) {
263
+					$this->localized_vars[ $var_name ] = array();
264
+				}
265
+				$this->localized_vars[ $var_name ][ $handle ] = $var;
266
+			}
267
+		}
268
+	}
269
+
270
+
271
+	/**
272
+	 * @param string $utm_content
273
+	 * @throws DomainException
274
+	 */
275
+	public function display($utm_content = '')
276
+	{
277
+		$this->content .= EEH_Template::powered_by_event_espresso(
278
+			'',
279
+			'',
280
+			! empty($utm_content) ? array('utm_content' => $utm_content) : array()
281
+		);
282
+		EE_System::do_not_cache();
283
+		echo $this->getTemplate(); // already escaped
284
+		exit;
285
+	}
286
+
287
+
288
+	/**
289
+	 * @return string
290
+	 * @throws DomainException
291
+	 */
292
+	public function getTemplate()
293
+	{
294
+		return EEH_Template::display_template(
295
+			__DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php',
296
+			array(
297
+				'title'                => apply_filters(
298
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
299
+					$this->title,
300
+					$this
301
+				),
302
+				'content'              => apply_filters(
303
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content',
304
+					$this->content,
305
+					$this
306
+				),
307
+				'enqueue_wp_assets'    => apply_filters(
308
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
309
+					$this->enqueue_wp_assets,
310
+					$this
311
+				),
312
+				'css'                  => (array) apply_filters(
313
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
314
+					$this->css,
315
+					$this
316
+				),
317
+				'header_js'            => (array) apply_filters(
318
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
319
+					$this->header_js,
320
+					$this
321
+				),
322
+				'header_js_attributes' => (array) apply_filters(
323
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_attributes',
324
+					$this->header_js_attributes,
325
+					$this
326
+				),
327
+				'footer_js'            => (array) apply_filters(
328
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
329
+					$this->footer_js,
330
+					$this
331
+				),
332
+				'footer_js_attributes' => (array) apply_filters(
333
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_attributes',
334
+					$this->footer_js_attributes,
335
+					$this
336
+				),
337
+				'eei18n'               => apply_filters(
338
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
339
+					EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars(),
340
+					$this
341
+				),
342
+				'notices'              => EEH_Template::display_template(
343
+					EE_TEMPLATES . 'espresso-ajax-notices.template.php',
344
+					array(),
345
+					true
346
+				),
347
+			),
348
+			true,
349
+			true
350
+		);
351
+	}
352
+
353
+
354
+	/**
355
+	 * localizeJsonVars
356
+	 *
357
+	 * @return string
358
+	 */
359
+	public function localizeJsonVars()
360
+	{
361
+		$JSON = '';
362
+		foreach ($this->localized_vars as $var_name => $vars) {
363
+			$this->localized_vars[ $var_name ] = $this->encodeJsonVars($vars);
364
+			$JSON .= "/* <![CDATA[ */ var {$var_name} = ";
365
+			$JSON .= wp_json_encode($this->localized_vars[ $var_name ]);
366
+			$JSON .= '; /* ]]> */';
367
+		}
368
+		return $JSON;
369
+	}
370
+
371
+
372
+	/**
373
+	 * @param bool|int|float|string|array $var
374
+	 * @return array|string|null
375
+	 */
376
+	public function encodeJsonVars($var)
377
+	{
378
+		if (is_array($var)) {
379
+			$localized_vars = array();
380
+			foreach ((array) $var as $key => $value) {
381
+				$localized_vars[ $key ] = $this->encodeJsonVars($value);
382
+			}
383
+			return $localized_vars;
384
+		}
385
+		if (is_scalar($var)) {
386
+			return html_entity_decode((string) $var, ENT_QUOTES, 'UTF-8');
387
+		}
388
+		return null;
389
+	}
390 390
 }
Please login to merge, or discard this patch.
core/domain/entities/shortcodes/EspressoCheckout.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -19,56 +19,56 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * the actual shortcode tag that gets registered with WordPress
24
-     *
25
-     * @return string
26
-     */
27
-    public function getTag()
28
-    {
29
-        return 'ESPRESSO_CHECKOUT';
30
-    }
22
+	/**
23
+	 * the actual shortcode tag that gets registered with WordPress
24
+	 *
25
+	 * @return string
26
+	 */
27
+	public function getTag()
28
+	{
29
+		return 'ESPRESSO_CHECKOUT';
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * the time in seconds to cache the results of the processShortcode() method
35
-     * 0 means the processShortcode() results will NOT be cached at all
36
-     *
37
-     * @return int
38
-     */
39
-    public function cacheExpiration()
40
-    {
41
-        return 0;
42
-    }
33
+	/**
34
+	 * the time in seconds to cache the results of the processShortcode() method
35
+	 * 0 means the processShortcode() results will NOT be cached at all
36
+	 *
37
+	 * @return int
38
+	 */
39
+	public function cacheExpiration()
40
+	{
41
+		return 0;
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * a place for adding any initialization code that needs to run prior to wp_header().
47
-     * this may be required for shortcodes that utilize a corresponding module,
48
-     * and need to enqueue assets for that module
49
-     *
50
-     * @return void
51
-     */
52
-    public function initializeShortcode()
53
-    {
54
-        global $wp_query;
55
-        EED_Single_Page_Checkout::init($wp_query);
56
-        $this->shortcodeHasBeenInitialized();
57
-    }
45
+	/**
46
+	 * a place for adding any initialization code that needs to run prior to wp_header().
47
+	 * this may be required for shortcodes that utilize a corresponding module,
48
+	 * and need to enqueue assets for that module
49
+	 *
50
+	 * @return void
51
+	 */
52
+	public function initializeShortcode()
53
+	{
54
+		global $wp_query;
55
+		EED_Single_Page_Checkout::init($wp_query);
56
+		$this->shortcodeHasBeenInitialized();
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * callback that runs when the shortcode is encountered in post content.
62
-     * IMPORTANT !!!
63
-     * remember that shortcode content should be RETURNED and NOT echoed out
64
-     *
65
-     * @param array $attributes
66
-     * @return string
67
-     */
68
-    public function processShortcode($attributes = array())
69
-    {
70
-        /** @var ResponseInterface $response */
71
-        $response = LoaderFactory::getLoader()->getShared(ResponseInterface::class);
72
-        return $response->getOutput();
73
-    }
60
+	/**
61
+	 * callback that runs when the shortcode is encountered in post content.
62
+	 * IMPORTANT !!!
63
+	 * remember that shortcode content should be RETURNED and NOT echoed out
64
+	 *
65
+	 * @param array $attributes
66
+	 * @return string
67
+	 */
68
+	public function processShortcode($attributes = array())
69
+	{
70
+		/** @var ResponseInterface $response */
71
+		$response = LoaderFactory::getLoader()->getShared(ResponseInterface::class);
72
+		return $response->getOutput();
73
+	}
74 74
 }
Please login to merge, or discard this patch.
modules/events_archive/EventsArchiveIframe.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -23,58 +23,58 @@
 block discarded – undo
23 23
 {
24 24
 
25 25
 
26
-    /**
27
-     * EventsArchiveIframe constructor.
28
-     *
29
-     * @param EED_Events_Archive $EED_Events_Archive
30
-     * @throws EE_Error
31
-     * @throws ReflectionException
32
-     */
33
-    public function __construct($EED_Events_Archive)
34
-    {
35
-        /** @var CurrentPage $current_page */
36
-        $current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
37
-        $current_page->setEspressoPage(true);
38
-        add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
39
-        $EED_Events_Archive->event_list();
40
-        /** @var EspressoEvents $event_list */
41
-        $event_list = EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents');
42
-        parent::__construct(
43
-            esc_html__('Event List', 'event_espresso'),
44
-            $event_list->processShortcode()
45
-        );
46
-        $this->addStylesheets(
47
-            apply_filters(
48
-                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
49
-                [
50
-                    'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
51
-                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
52
-                        : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
53
-                ],
54
-                $this
55
-            )
56
-        );
57
-        $this->addScripts(
58
-            apply_filters(
59
-                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
60
-                [
61
-                    'gmap_api' => sprintf(
62
-                        'https://maps.googleapis.com/maps/api/js?key=%s',
63
-                        apply_filters(
64
-                            'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
65
-                            EE_Registry::instance()->CFG->map_settings->google_map_api_key
66
-                        )
67
-                    ),
68
-                    'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
69
-                ],
70
-                $this
71
-            )
72
-        );
73
-        $this->addLocalizedVars(
74
-            [
75
-                'ee_gmap' => EEH_Maps::$gmap_vars,
76
-            ],
77
-            'ee_gmap_vars'
78
-        );
79
-    }
26
+	/**
27
+	 * EventsArchiveIframe constructor.
28
+	 *
29
+	 * @param EED_Events_Archive $EED_Events_Archive
30
+	 * @throws EE_Error
31
+	 * @throws ReflectionException
32
+	 */
33
+	public function __construct($EED_Events_Archive)
34
+	{
35
+		/** @var CurrentPage $current_page */
36
+		$current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
37
+		$current_page->setEspressoPage(true);
38
+		add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
39
+		$EED_Events_Archive->event_list();
40
+		/** @var EspressoEvents $event_list */
41
+		$event_list = EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents');
42
+		parent::__construct(
43
+			esc_html__('Event List', 'event_espresso'),
44
+			$event_list->processShortcode()
45
+		);
46
+		$this->addStylesheets(
47
+			apply_filters(
48
+				'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
49
+				[
50
+					'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
51
+						? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
52
+						: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
53
+				],
54
+				$this
55
+			)
56
+		);
57
+		$this->addScripts(
58
+			apply_filters(
59
+				'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
60
+				[
61
+					'gmap_api' => sprintf(
62
+						'https://maps.googleapis.com/maps/api/js?key=%s',
63
+						apply_filters(
64
+							'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
65
+							EE_Registry::instance()->CFG->map_settings->google_map_api_key
66
+						)
67
+					),
68
+					'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
69
+				],
70
+				$this
71
+			)
72
+		);
73
+		$this->addLocalizedVars(
74
+			[
75
+				'ee_gmap' => EEH_Maps::$gmap_vars,
76
+			],
77
+			'ee_gmap_vars'
78
+		);
79
+	}
80 80
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
             apply_filters(
48 48
                 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
49 49
                 [
50
-                    'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
51
-                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
52
-                        : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
50
+                    'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')
51
+                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
52
+                        : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION,
53 53
                 ],
54 54
                 $this
55 55
             )
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                             EE_Registry::instance()->CFG->map_settings->google_map_api_key
66 66
                         )
67 67
                     ),
68
-                    'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
68
+                    'ee_gmap'  => EE_HELPERS_ASSETS.'ee_gmap.js?ver=1.0',
69 69
                 ],
70 70
                 $this
71 71
             )
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorSimple.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -20,58 +20,58 @@
 block discarded – undo
20 20
 class TicketSelectorSimple extends TicketSelector
21 21
 {
22 22
 
23
-    /**
24
-     * @var EE_Ticket $ticket
25
-     */
26
-    protected $ticket;
23
+	/**
24
+	 * @var EE_Ticket $ticket
25
+	 */
26
+	protected $ticket;
27 27
 
28 28
 
29
-    /**
30
-     * TicketSelectorSimple constructor.
31
-     *
32
-     * @param EE_Event  $event
33
-     * @param EE_Ticket $ticket
34
-     * @param int       $max_attendees
35
-     * @param array     $template_args
36
-     * @throws EE_Error
37
-     */
38
-    public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args)
39
-    {
40
-        $this->ticket = $ticket;
41
-        parent::__construct(
42
-            $event,
43
-            [$this->ticket],
44
-            $max_attendees,
45
-            $template_args
46
-        );
47
-    }
29
+	/**
30
+	 * TicketSelectorSimple constructor.
31
+	 *
32
+	 * @param EE_Event  $event
33
+	 * @param EE_Ticket $ticket
34
+	 * @param int       $max_attendees
35
+	 * @param array     $template_args
36
+	 * @throws EE_Error
37
+	 */
38
+	public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args)
39
+	{
40
+		$this->ticket = $ticket;
41
+		parent::__construct(
42
+			$event,
43
+			[$this->ticket],
44
+			$max_attendees,
45
+			$template_args
46
+		);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * sets any and all template args that are required for this Ticket Selector
52
-     *
53
-     * @return void
54
-     * @throws UnexpectedEntityException
55
-     * @throws EE_Error
56
-     */
57
-    protected function addTemplateArgs()
58
-    {
59
-        unset($this->template_args['tickets']);
60
-        $this->template_args['ticket'] = $this->ticket;
61
-        $ticket_selector_row           = new TicketSelectorRowSimple(
62
-            $this->ticket,
63
-            $this->max_attendees,
64
-            $this->template_args['date_format'],
65
-            $this->template_args['event_status']
66
-        );
67
-        $this->template_args['TKT_ID'] = $this->ticket->ID();
68
-        $ticket_selector_row->setupTicketStatusDisplay();
69
-        $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay();
70
-        if (empty($this->template_args['ticket_status_display'])) {
71
-            add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
72
-        }
73
-        $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription();
74
-        $this->template_args['template_path']      =
75
-            TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php';
76
-    }
50
+	/**
51
+	 * sets any and all template args that are required for this Ticket Selector
52
+	 *
53
+	 * @return void
54
+	 * @throws UnexpectedEntityException
55
+	 * @throws EE_Error
56
+	 */
57
+	protected function addTemplateArgs()
58
+	{
59
+		unset($this->template_args['tickets']);
60
+		$this->template_args['ticket'] = $this->ticket;
61
+		$ticket_selector_row           = new TicketSelectorRowSimple(
62
+			$this->ticket,
63
+			$this->max_attendees,
64
+			$this->template_args['date_format'],
65
+			$this->template_args['event_status']
66
+		);
67
+		$this->template_args['TKT_ID'] = $this->ticket->ID();
68
+		$ticket_selector_row->setupTicketStatusDisplay();
69
+		$this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay();
70
+		if (empty($this->template_args['ticket_status_display'])) {
71
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
72
+		}
73
+		$this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription();
74
+		$this->template_args['template_path']      =
75
+			TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php';
76
+	}
77 77
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,6 +72,6 @@
 block discarded – undo
72 72
         }
73 73
         $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription();
74 74
         $this->template_args['template_path']      =
75
-            TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php';
75
+            TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php';
76 76
     }
77 77
 }
Please login to merge, or discard this patch.
modules/feeds/EED_Feeds.module.php 2 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -12,218 +12,218 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    /**
16
-     * @return EED_Feeds
17
-     */
18
-    public static function instance()
19
-    {
20
-        return parent::get_instance(__CLASS__);
21
-    }
22
-
23
-
24
-    /**
25
-     *    set_hooks - for hooking into EE Core, other modules, etc
26
-     *
27
-     * @access    public
28
-     * @return    void
29
-     */
30
-    public static function set_hooks()
31
-    {
32
-        add_action('parse_request', array('EED_Feeds', 'parse_request'), 10);
33
-        add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1);
34
-        add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2);
35
-        add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2);
36
-    }
37
-
38
-    /**
39
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
40
-     *
41
-     * @access    public
42
-     * @return    void
43
-     */
44
-    public static function set_hooks_admin()
45
-    {
46
-    }
47
-
48
-
49
-    /**
50
-     *    run - initial module setup
51
-     *
52
-     * @access    public
53
-     * @return    void
54
-     */
55
-    public function run($WP)
56
-    {
57
-    }
58
-
59
-
60
-    /**
61
-     *    default_feed
62
-     *
63
-     * @access    public
64
-     * @param    type    rss2, atom, rss, rdf, rssjs
65
-     * @return    string
66
-     */
67
-    public static function default_feed($type = 'rss2')
68
-    {
69
-        // rss2, atom, rss, rdf, rssjs
70
-        $type = 'rss2';
71
-        return $type;
72
-    }
73
-
74
-
75
-    /**
76
-     *    parse_request
77
-     *
78
-     * @access    public
79
-     * @return    void
80
-     */
81
-    public static function parse_request()
82
-    {
83
-        $request = self::getRequest();
84
-        if ($request->requestParamIsSet('post_type')) {
85
-            // define path to templates
86
-            define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
87
-            // what kinda post_type are we dealing with ?
88
-            switch ($request->getRequestParam('post_type')) {
89
-                case 'espresso_events':
90
-                    // for rss2, atom, rss, rdf
91
-                    add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1);
92
-                    add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1);
93
-                    // for json ( also uses the above filter )
94
-                    add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1);
95
-                    break;
96
-                case 'espresso_venues':
97
-                    // for rss2, atom, rss, rdf
98
-                    add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1);
99
-                    add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1);
100
-                    // for json ( also uses the above filter )
101
-                    add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1);
102
-                    break;
103
-            }
104
-        }
105
-    }
106
-
107
-
108
-    /**
109
-     *    comment_feed_join - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
110
-     *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
111
-     *    so this little snippet of SQL taps into the comment feed query and removes comments for the
112
-     *    espresso_attendees post_type
113
-     *
114
-     * @access    public
115
-     * @param    string $SQL the JOIN clause for the comment feed query
116
-     * @return    void
117
-     */
118
-    public static function comment_feed_join($SQL)
119
-    {
120
-        global $wpdb;
121
-        // check for wp_posts table in JOIN clause
122
-        if (strpos($SQL, $wpdb->posts) !== false) {
123
-            add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true');
124
-        }
125
-        return $SQL;
126
-    }
127
-
128
-
129
-    /**
130
-     *    comment_feed_where - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
131
-     *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
132
-     *    so this little snippet of SQL taps into the comment feed query and removes comments for the
133
-     *    espresso_attendees post_type
134
-     *
135
-     * @access    public
136
-     * @param    string $SQL the WHERE clause for the comment feed query
137
-     * @return    void
138
-     */
139
-    public static function comment_feed_where($SQL)
140
-    {
141
-        global $wp_query, $wpdb;
142
-        if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', false)) {
143
-            $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'";
144
-        }
145
-        return $SQL;
146
-    }
147
-
148
-
149
-    /**
150
-     *    the_event_feed
151
-     *
152
-     * @access    public
153
-     * @param    string $content
154
-     * @return    void
155
-     */
156
-    public static function the_event_feed($content)
157
-    {
158
-        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php')) {
159
-            global $post;
160
-            $template_args = array(
161
-                'EVT_ID'            => $post->ID,
162
-                'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
163
-            );
164
-            $content = EEH_Template::display_template(
165
-                RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php',
166
-                $template_args,
167
-                true
168
-            );
169
-        }
170
-        return $content;
171
-    }
172
-
173
-
174
-    /**
175
-     *    the_event_rssjs_feed
176
-     *
177
-     * @access    public
178
-     * @param    object $item
179
-     * @return    void
180
-     */
181
-    public static function the_event_rssjs_feed($item)
182
-    {
183
-        if (is_feed() && isset($item->description)) {
184
-            $item->description = EED_Feeds::the_event_feed($item->description);
185
-        }
186
-        return $item;
187
-    }
188
-
189
-
190
-    /**
191
-     *    the_venue_feed
192
-     *
193
-     * @access    public
194
-     * @param    string $content
195
-     * @return    void
196
-     */
197
-    public static function the_venue_feed($content)
198
-    {
199
-        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php')) {
200
-            global $post;
201
-            $template_args = array(
202
-                'VNU_ID'            => $post->ID,
203
-                'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
204
-            );
205
-            $content = EEH_Template::display_template(
206
-                RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php',
207
-                $template_args,
208
-                true
209
-            );
210
-        }
211
-        return $content;
212
-    }
213
-
214
-
215
-    /**
216
-     *    the_venue_rssjs_feed
217
-     *
218
-     * @access    public
219
-     * @param    object $item
220
-     * @return    void
221
-     */
222
-    public static function the_venue_rssjs_feed($item)
223
-    {
224
-        if (is_feed() && isset($item->description)) {
225
-            $item->description = EED_Feeds::the_venue_feed($item->description);
226
-        }
227
-        return $item;
228
-    }
15
+	/**
16
+	 * @return EED_Feeds
17
+	 */
18
+	public static function instance()
19
+	{
20
+		return parent::get_instance(__CLASS__);
21
+	}
22
+
23
+
24
+	/**
25
+	 *    set_hooks - for hooking into EE Core, other modules, etc
26
+	 *
27
+	 * @access    public
28
+	 * @return    void
29
+	 */
30
+	public static function set_hooks()
31
+	{
32
+		add_action('parse_request', array('EED_Feeds', 'parse_request'), 10);
33
+		add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1);
34
+		add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2);
35
+		add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2);
36
+	}
37
+
38
+	/**
39
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
40
+	 *
41
+	 * @access    public
42
+	 * @return    void
43
+	 */
44
+	public static function set_hooks_admin()
45
+	{
46
+	}
47
+
48
+
49
+	/**
50
+	 *    run - initial module setup
51
+	 *
52
+	 * @access    public
53
+	 * @return    void
54
+	 */
55
+	public function run($WP)
56
+	{
57
+	}
58
+
59
+
60
+	/**
61
+	 *    default_feed
62
+	 *
63
+	 * @access    public
64
+	 * @param    type    rss2, atom, rss, rdf, rssjs
65
+	 * @return    string
66
+	 */
67
+	public static function default_feed($type = 'rss2')
68
+	{
69
+		// rss2, atom, rss, rdf, rssjs
70
+		$type = 'rss2';
71
+		return $type;
72
+	}
73
+
74
+
75
+	/**
76
+	 *    parse_request
77
+	 *
78
+	 * @access    public
79
+	 * @return    void
80
+	 */
81
+	public static function parse_request()
82
+	{
83
+		$request = self::getRequest();
84
+		if ($request->requestParamIsSet('post_type')) {
85
+			// define path to templates
86
+			define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
87
+			// what kinda post_type are we dealing with ?
88
+			switch ($request->getRequestParam('post_type')) {
89
+				case 'espresso_events':
90
+					// for rss2, atom, rss, rdf
91
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1);
92
+					add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1);
93
+					// for json ( also uses the above filter )
94
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1);
95
+					break;
96
+				case 'espresso_venues':
97
+					// for rss2, atom, rss, rdf
98
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1);
99
+					add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1);
100
+					// for json ( also uses the above filter )
101
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1);
102
+					break;
103
+			}
104
+		}
105
+	}
106
+
107
+
108
+	/**
109
+	 *    comment_feed_join - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
110
+	 *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
111
+	 *    so this little snippet of SQL taps into the comment feed query and removes comments for the
112
+	 *    espresso_attendees post_type
113
+	 *
114
+	 * @access    public
115
+	 * @param    string $SQL the JOIN clause for the comment feed query
116
+	 * @return    void
117
+	 */
118
+	public static function comment_feed_join($SQL)
119
+	{
120
+		global $wpdb;
121
+		// check for wp_posts table in JOIN clause
122
+		if (strpos($SQL, $wpdb->posts) !== false) {
123
+			add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true');
124
+		}
125
+		return $SQL;
126
+	}
127
+
128
+
129
+	/**
130
+	 *    comment_feed_where - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
131
+	 *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
132
+	 *    so this little snippet of SQL taps into the comment feed query and removes comments for the
133
+	 *    espresso_attendees post_type
134
+	 *
135
+	 * @access    public
136
+	 * @param    string $SQL the WHERE clause for the comment feed query
137
+	 * @return    void
138
+	 */
139
+	public static function comment_feed_where($SQL)
140
+	{
141
+		global $wp_query, $wpdb;
142
+		if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', false)) {
143
+			$SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'";
144
+		}
145
+		return $SQL;
146
+	}
147
+
148
+
149
+	/**
150
+	 *    the_event_feed
151
+	 *
152
+	 * @access    public
153
+	 * @param    string $content
154
+	 * @return    void
155
+	 */
156
+	public static function the_event_feed($content)
157
+	{
158
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php')) {
159
+			global $post;
160
+			$template_args = array(
161
+				'EVT_ID'            => $post->ID,
162
+				'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
163
+			);
164
+			$content = EEH_Template::display_template(
165
+				RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php',
166
+				$template_args,
167
+				true
168
+			);
169
+		}
170
+		return $content;
171
+	}
172
+
173
+
174
+	/**
175
+	 *    the_event_rssjs_feed
176
+	 *
177
+	 * @access    public
178
+	 * @param    object $item
179
+	 * @return    void
180
+	 */
181
+	public static function the_event_rssjs_feed($item)
182
+	{
183
+		if (is_feed() && isset($item->description)) {
184
+			$item->description = EED_Feeds::the_event_feed($item->description);
185
+		}
186
+		return $item;
187
+	}
188
+
189
+
190
+	/**
191
+	 *    the_venue_feed
192
+	 *
193
+	 * @access    public
194
+	 * @param    string $content
195
+	 * @return    void
196
+	 */
197
+	public static function the_venue_feed($content)
198
+	{
199
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php')) {
200
+			global $post;
201
+			$template_args = array(
202
+				'VNU_ID'            => $post->ID,
203
+				'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
204
+			);
205
+			$content = EEH_Template::display_template(
206
+				RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php',
207
+				$template_args,
208
+				true
209
+			);
210
+		}
211
+		return $content;
212
+	}
213
+
214
+
215
+	/**
216
+	 *    the_venue_rssjs_feed
217
+	 *
218
+	 * @access    public
219
+	 * @param    object $item
220
+	 * @return    void
221
+	 */
222
+	public static function the_venue_rssjs_feed($item)
223
+	{
224
+		if (is_feed() && isset($item->description)) {
225
+			$item->description = EED_Feeds::the_venue_feed($item->description);
226
+		}
227
+		return $item;
228
+	}
229 229
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $request = self::getRequest();
84 84
         if ($request->requestParamIsSet('post_type')) {
85 85
             // define path to templates
86
-            define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
86
+            define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)).'templates/');
87 87
             // what kinda post_type are we dealing with ?
88 88
             switch ($request->getRequestParam('post_type')) {
89 89
                 case 'espresso_events':
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public static function the_event_feed($content)
157 157
     {
158
-        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php')) {
158
+        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) {
159 159
             global $post;
160 160
             $template_args = array(
161 161
                 'EVT_ID'            => $post->ID,
162 162
                 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
163 163
             );
164 164
             $content = EEH_Template::display_template(
165
-                RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php',
165
+                RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php',
166 166
                 $template_args,
167 167
                 true
168 168
             );
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public static function the_venue_feed($content)
198 198
     {
199
-        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php')) {
199
+        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) {
200 200
             global $post;
201 201
             $template_args = array(
202 202
                 'VNU_ID'            => $post->ID,
203 203
                 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
204 204
             );
205 205
             $content = EEH_Template::display_template(
206
-                RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php',
206
+                RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php',
207 207
                 $template_args,
208 208
                 true
209 209
             );
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function set_submit_button_text($submit_button_text = '')
230 230
     {
231
-        if (! empty($submit_button_text)) {
231
+        if ( ! empty($submit_button_text)) {
232 232
             $this->_submit_button_text = $submit_button_text;
233 233
         } elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
234 234
             if ($this->checkout->revisit) {
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     public function reg_form_name()
389 389
     {
390 390
         if (empty($this->_reg_form_name)) {
391
-            $this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form');
391
+            $this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form');
392 392
         }
393 393
         return $this->_reg_form_name;
394 394
     }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     public function reg_step_url($action = '')
413 413
     {
414 414
         $query_args = ['step' => $this->slug()];
415
-        if (! empty($action)) {
415
+        if ( ! empty($action)) {
416 416
             $query_args['action'] = $action;
417 417
         }
418 418
         // final step has no display
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
             return new EE_Form_Section_Proper(
443 443
                 [
444 444
                     'layout_strategy' => new EE_Div_Per_Section_Layout(),
445
-                    'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
445
+                    'html_id'         => 'ee-'.$this->slug().'-hidden-inputs',
446 446
                     'subsections'     => [
447 447
                         'next_step' => new EE_Fixed_Hidden_Input(
448 448
                             [
449 449
                                 'html_name' => 'next_step',
450
-                                'html_id'   => 'spco-' . $this->slug() . '-next-step',
450
+                                'html_id'   => 'spco-'.$this->slug().'-next-step',
451 451
                                 'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
452 452
                                     ? $this->checkout->next_step->slug()
453 453
                                     : '',
@@ -461,12 +461,12 @@  discard block
 block discarded – undo
461 461
         return new EE_Form_Section_Proper(
462 462
             [
463 463
                 'layout_strategy' => new EE_Div_Per_Section_Layout(),
464
-                'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
464
+                'html_id'         => 'ee-'.$this->slug().'-hidden-inputs',
465 465
                 'subsections'     => [
466 466
                     'action'         => new EE_Fixed_Hidden_Input(
467 467
                         [
468 468
                             'html_name' => 'action',
469
-                            'html_id'   => 'spco-' . $this->slug() . '-action',
469
+                            'html_id'   => 'spco-'.$this->slug().'-action',
470 470
                             'default'   => apply_filters(
471 471
                                 'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',
472 472
                                 empty($this->checkout->reg_url_link)
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
                     'next_step'      => new EE_Fixed_Hidden_Input(
480 480
                         [
481 481
                             'html_name' => 'next_step',
482
-                            'html_id'   => 'spco-' . $this->slug() . '-next-step',
482
+                            'html_id'   => 'spco-'.$this->slug().'-next-step',
483 483
                             'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
484 484
                                 ? $this->checkout->next_step->slug()
485 485
                                 : '',
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
      */
514 514
     public function generate_reg_form_for_actions($actions = [])
515 515
     {
516
-        $actions                           = array_merge(
516
+        $actions = array_merge(
517 517
             [
518 518
                 'generate_reg_form',
519 519
                 'display_spco_reg_step',
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      */
557 557
     public function reg_step_submit_button()
558 558
     {
559
-        if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
559
+        if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
560 560
             return '';
561 561
         }
562 562
         ob_start();
@@ -570,18 +570,18 @@  discard block
 block discarded – undo
570 570
         // generate submit button
571 571
         $submit_btn = new EE_Submit_Input(
572 572
             [
573
-                'html_name'             => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
574
-                'html_id'               => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
573
+                'html_name'             => 'spco-go-to-step-'.$this->checkout->next_step->slug(),
574
+                'html_id'               => 'spco-go-to-step-'.$this->checkout->next_step->slug(),
575 575
                 'html_class'            => 'spco-next-step-btn',
576
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
576
+                'other_html_attributes' => ' rel="'.$this->slug().'"',
577 577
                 'default'               => $this->submit_button_text(),
578 578
             ]
579 579
         );
580 580
         $submit_btn->set_button_css_attributes(true, 'large');
581 581
         $submit_btn_html = $submit_btn->get_html_for_input();
582
-        $html            .= EEH_HTML::div(
582
+        $html .= EEH_HTML::div(
583 583
             apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $submit_btn_html, $this),
584
-            'spco-' . $this->slug() . '-whats-next-buttons-dv',
584
+            'spco-'.$this->slug().'-whats-next-buttons-dv',
585 585
             'spco-whats-next-buttons'
586 586
         );
587 587
         return $html;
Please login to merge, or discard this patch.
Indentation   +644 added lines, -644 removed lines patch added patch discarded remove patch
@@ -14,648 +14,648 @@
 block discarded – undo
14 14
 abstract class EE_SPCO_Reg_Step
15 15
 {
16 16
 
17
-    /**
18
-     *    $_completed - TRUE if this step has fully completed it's duties
19
-     *
20
-     * @access protected
21
-     * @type bool $_completed
22
-     */
23
-    protected $_completed = false;
24
-
25
-    /**
26
-     *    $_is_current_step - TRUE if this is the current step
27
-     *
28
-     * @access protected
29
-     * @type bool $_is_current_step
30
-     */
31
-    protected $_is_current_step = false;
32
-
33
-    /**
34
-     *    $_order - when the reg step should be run relative to other steps
35
-     *
36
-     * @access protected
37
-     * @type int $_template
38
-     */
39
-    protected $_order = 0;
40
-
41
-    /**
42
-     *    $_slug - URL param for this step
43
-     *
44
-     * @access protected
45
-     * @type string $_slug
46
-     */
47
-    protected $_slug;
48
-
49
-    /**
50
-     *    $_name - Step Name - translatable string
51
-     *
52
-     * @access protected
53
-     * @type string $_slug
54
-     */
55
-    protected $_name;
56
-
57
-    /**
58
-     *    $_submit_button_text - translatable string that appears on this step's submit button
59
-     *
60
-     * @access protected
61
-     * @type string $_slug
62
-     */
63
-    protected $_submit_button_text;
64
-
65
-    /**
66
-     *    $_template - template name
67
-     *
68
-     * @access protected
69
-     * @type string $_template
70
-     */
71
-    protected $_template;
72
-
73
-    /**
74
-     *    $_reg_form_name - the form input name and id attribute
75
-     *
76
-     * @access protected
77
-     * @var string $_reg_form_name
78
-     */
79
-    protected $_reg_form_name;
80
-
81
-    /**
82
-     *    $_success_message - text to display upon successful form submission
83
-     *
84
-     * @access private
85
-     * @var string $_success_message
86
-     */
87
-    protected $_success_message;
88
-
89
-    /**
90
-     *    $_instructions - a brief description of how to complete the reg step.
91
-     *    Usually displayed in conjunction with the previous step's success message.
92
-     *
93
-     * @access private
94
-     * @var string $_instructions
95
-     */
96
-    protected $_instructions;
97
-
98
-    /**
99
-     *    $_valid_data - the normalized and validated data for this step
100
-     *
101
-     * @access public
102
-     * @var array $_valid_data
103
-     */
104
-    protected $_valid_data = [];
105
-
106
-    /**
107
-     *    $reg_form - the registration form for this step
108
-     *
109
-     * @access public
110
-     * @var EE_Form_Section_Proper $reg_form
111
-     */
112
-    public $reg_form;
113
-
114
-    /**
115
-     *    $checkout - EE_Checkout object for handling the properties of the current checkout process
116
-     *
117
-     * @access public
118
-     * @var EE_Checkout $checkout
119
-     */
120
-    public $checkout;
121
-
122
-    /**
123
-     * @var RequestInterface $request
124
-     */
125
-    protected $request;
126
-
127
-
128
-    /**
129
-     * @return void
130
-     */
131
-    abstract public function translate_js_strings();
132
-
133
-
134
-    /**
135
-     * @return void
136
-     */
137
-    abstract public function enqueue_styles_and_scripts();
138
-
139
-
140
-    /**
141
-     * @return boolean
142
-     */
143
-    abstract public function initialize_reg_step();
144
-
145
-
146
-    /**
147
-     * @return string
148
-     */
149
-    abstract public function generate_reg_form();
150
-
151
-
152
-    /**
153
-     * @return boolean
154
-     */
155
-    abstract public function process_reg_step();
156
-
157
-
158
-    /**
159
-     * @return boolean
160
-     */
161
-    abstract public function update_reg_step();
162
-
163
-
164
-    /**
165
-     * @return boolean
166
-     */
167
-    public function completed()
168
-    {
169
-        return $this->_completed;
170
-    }
171
-
172
-
173
-    /**
174
-     * set_completed - toggles $_completed to TRUE
175
-     */
176
-    public function set_completed()
177
-    {
178
-        // DEBUG LOG
179
-        // $this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
180
-        $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this);
181
-    }
182
-
183
-
184
-    /**
185
-     * set_completed - toggles $_completed to FALSE
186
-     */
187
-    public function set_not_completed()
188
-    {
189
-        $this->_completed = false;
190
-    }
191
-
192
-
193
-    /**
194
-     * @return string
195
-     */
196
-    public function name()
197
-    {
198
-        return $this->_name;
199
-    }
200
-
201
-
202
-    /**
203
-     * @return string
204
-     */
205
-    public function slug()
206
-    {
207
-        return $this->_slug;
208
-    }
209
-
210
-
211
-    /**
212
-     * submit_button_text
213
-     * the text that appears on the reg step form submit button
214
-     *
215
-     * @return string
216
-     */
217
-    public function submit_button_text()
218
-    {
219
-        return $this->_submit_button_text;
220
-    }
221
-
222
-
223
-    /**
224
-     * set_submit_button_text
225
-     * sets the text that appears on the reg step form submit button
226
-     *
227
-     * @param string $submit_button_text
228
-     */
229
-    public function set_submit_button_text($submit_button_text = '')
230
-    {
231
-        if (! empty($submit_button_text)) {
232
-            $this->_submit_button_text = $submit_button_text;
233
-        } elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
234
-            if ($this->checkout->revisit) {
235
-                $this->_submit_button_text = sprintf(
236
-                    esc_html__('Update %s', 'event_espresso'),
237
-                    $this->checkout->current_step->name()
238
-                );
239
-            } else {
240
-                $this->_submit_button_text = sprintf(
241
-                    esc_html__('Proceed to %s', 'event_espresso'),
242
-                    $this->checkout->next_step->name()
243
-                );
244
-            }
245
-        }
246
-        // filters the submit button text
247
-        $this->_submit_button_text = apply_filters(
248
-            'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
249
-            $this->_submit_button_text,
250
-            $this->checkout
251
-        );
252
-    }
253
-
254
-
255
-    /**
256
-     * @param boolean $is_current_step
257
-     */
258
-    public function set_is_current_step($is_current_step)
259
-    {
260
-        $this->_is_current_step = $is_current_step;
261
-    }
262
-
263
-
264
-    /**
265
-     * @return boolean
266
-     */
267
-    public function is_current_step()
268
-    {
269
-        return $this->_is_current_step;
270
-    }
271
-
272
-
273
-    /**
274
-     * @return boolean
275
-     */
276
-    public function is_final_step()
277
-    {
278
-        return $this instanceof EE_SPCO_Reg_Step_Finalize_Registration;
279
-    }
280
-
281
-
282
-    /**
283
-     * @param int $order
284
-     */
285
-    public function set_order($order)
286
-    {
287
-        $this->_order = $order;
288
-    }
289
-
290
-
291
-    /**
292
-     * @return int
293
-     */
294
-    public function order()
295
-    {
296
-        return $this->_order;
297
-    }
298
-
299
-
300
-    /**
301
-     * @return string
302
-     */
303
-    public function template()
304
-    {
305
-        return $this->_template;
306
-    }
307
-
308
-
309
-    /**
310
-     * @return string
311
-     */
312
-    public function success_message()
313
-    {
314
-        return $this->_success_message;
315
-    }
316
-
317
-
318
-    /**
319
-     * _set_success_message
320
-     *
321
-     * @param string $success_message
322
-     */
323
-    protected function _set_success_message($success_message)
324
-    {
325
-        $this->_success_message = $success_message;
326
-    }
327
-
328
-
329
-    /**
330
-     * _reset_success_message
331
-     *
332
-     * @return void
333
-     */
334
-    protected function _reset_success_message()
335
-    {
336
-        $this->_success_message = '';
337
-    }
338
-
339
-
340
-    /**
341
-     * @return string
342
-     */
343
-    public function _instructions()
344
-    {
345
-        return $this->_instructions;
346
-    }
347
-
348
-
349
-    /**
350
-     * @param string $instructions
351
-     */
352
-    public function set_instructions($instructions)
353
-    {
354
-        $this->_instructions = apply_filters(
355
-            'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions',
356
-            $instructions,
357
-            $this
358
-        );
359
-    }
360
-
361
-
362
-    /**
363
-     * @param array $valid_data
364
-     */
365
-    public function set_valid_data($valid_data)
366
-    {
367
-        $this->_valid_data = $valid_data;
368
-    }
369
-
370
-
371
-    /**
372
-     * @return array
373
-     * @throws EE_Error
374
-     * @throws EE_Error
375
-     */
376
-    public function valid_data()
377
-    {
378
-        if (empty($this->_valid_data)) {
379
-            $this->_valid_data = $this->reg_form->valid_data();
380
-        }
381
-        return $this->_valid_data;
382
-    }
383
-
384
-
385
-    /**
386
-     * @return string
387
-     */
388
-    public function reg_form_name()
389
-    {
390
-        if (empty($this->_reg_form_name)) {
391
-            $this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form');
392
-        }
393
-        return $this->_reg_form_name;
394
-    }
395
-
396
-
397
-    /**
398
-     * @param string $reg_form_name
399
-     */
400
-    protected function set_reg_form_name($reg_form_name)
401
-    {
402
-        $this->_reg_form_name = $reg_form_name;
403
-    }
404
-
405
-
406
-    /**
407
-     * reg_step_url
408
-     *
409
-     * @param string $action
410
-     * @return string
411
-     */
412
-    public function reg_step_url($action = '')
413
-    {
414
-        $query_args = ['step' => $this->slug()];
415
-        if (! empty($action)) {
416
-            $query_args['action'] = $action;
417
-        }
418
-        // final step has no display
419
-        if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') {
420
-            $query_args['action'] = 'process_reg_step';
421
-        }
422
-        if ($this->checkout->revisit) {
423
-            $query_args['revisit'] = true;
424
-        }
425
-        if ($this->checkout->reg_url_link) {
426
-            $query_args['e_reg_url_link'] = $this->checkout->reg_url_link;
427
-        }
428
-        return add_query_arg($query_args, $this->checkout->reg_page_base_url);
429
-    }
430
-
431
-
432
-    /**
433
-     * creates the default hidden inputs section
434
-     *
435
-     * @return EE_Form_Section_Proper
436
-     * @throws EE_Error
437
-     */
438
-    public function reg_step_hidden_inputs()
439
-    {
440
-        // hidden inputs for admin registrations
441
-        if ($this->checkout->admin_request) {
442
-            return new EE_Form_Section_Proper(
443
-                [
444
-                    'layout_strategy' => new EE_Div_Per_Section_Layout(),
445
-                    'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
446
-                    'subsections'     => [
447
-                        'next_step' => new EE_Fixed_Hidden_Input(
448
-                            [
449
-                                'html_name' => 'next_step',
450
-                                'html_id'   => 'spco-' . $this->slug() . '-next-step',
451
-                                'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
452
-                                    ? $this->checkout->next_step->slug()
453
-                                    : '',
454
-                            ]
455
-                        ),
456
-                    ],
457
-                ]
458
-            );
459
-        }
460
-        // hidden inputs for frontend registrations
461
-        return new EE_Form_Section_Proper(
462
-            [
463
-                'layout_strategy' => new EE_Div_Per_Section_Layout(),
464
-                'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
465
-                'subsections'     => [
466
-                    'action'         => new EE_Fixed_Hidden_Input(
467
-                        [
468
-                            'html_name' => 'action',
469
-                            'html_id'   => 'spco-' . $this->slug() . '-action',
470
-                            'default'   => apply_filters(
471
-                                'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',
472
-                                empty($this->checkout->reg_url_link)
473
-                                    ? 'process_reg_step'
474
-                                    : 'update_reg_step',
475
-                                $this
476
-                            ),
477
-                        ]
478
-                    ),
479
-                    'next_step'      => new EE_Fixed_Hidden_Input(
480
-                        [
481
-                            'html_name' => 'next_step',
482
-                            'html_id'   => 'spco-' . $this->slug() . '-next-step',
483
-                            'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
484
-                                ? $this->checkout->next_step->slug()
485
-                                : '',
486
-                        ]
487
-                    ),
488
-                    'e_reg_url_link' => new EE_Fixed_Hidden_Input(
489
-                        [
490
-                            'html_name' => 'e_reg_url_link',
491
-                            'html_id'   => 'spco-reg_url_link',
492
-                            'default'   => $this->checkout->reg_url_link,
493
-                        ]
494
-                    ),
495
-                    'revisit'        => new EE_Fixed_Hidden_Input(
496
-                        [
497
-                            'html_name' => 'revisit',
498
-                            'html_id'   => 'spco-revisit',
499
-                            'default'   => $this->checkout->revisit,
500
-                        ]
501
-                    ),
502
-                ],
503
-            ]
504
-        );
505
-    }
506
-
507
-
508
-    /**
509
-     * generate_reg_form_for_actions
510
-     *
511
-     * @param array $actions
512
-     * @return void
513
-     */
514
-    public function generate_reg_form_for_actions($actions = [])
515
-    {
516
-        $actions                           = array_merge(
517
-            [
518
-                'generate_reg_form',
519
-                'display_spco_reg_step',
520
-                'process_reg_step',
521
-                'update_reg_step',
522
-            ],
523
-            $actions
524
-        );
525
-        $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions, true);
526
-    }
527
-
528
-
529
-    /**
530
-     * @return string
531
-     * @throws EE_Error
532
-     */
533
-    public function display_reg_form()
534
-    {
535
-        $html = '';
536
-        if ($this->reg_form instanceof EE_Form_Section_Proper) {
537
-            do_action('AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', $this->reg_form, $this);
538
-            $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';
539
-            if ($this->request->isAjax()) {
540
-                $this->reg_form->localize_validation_rules();
541
-                $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
542
-            }
543
-            $html .= $this->reg_form->get_html();
544
-            $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : '';
545
-            $html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : '';
546
-        }
547
-        return $html;
548
-    }
549
-
550
-
551
-    /**
552
-     * div_class - returns nothing for current step, but a css class of "hidden" for others
553
-     *
554
-     * @return string
555
-     * @throws EE_Error
556
-     */
557
-    public function reg_step_submit_button()
558
-    {
559
-        if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
560
-            return '';
561
-        }
562
-        ob_start();
563
-        do_action(
564
-            'AHEE__before_spco_whats_next_buttons',
565
-            $this->slug(),
566
-            $this->checkout->next_step->slug(),
567
-            $this->checkout
568
-        );
569
-        $html = ob_get_clean();
570
-        // generate submit button
571
-        $submit_btn = new EE_Submit_Input(
572
-            [
573
-                'html_name'             => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
574
-                'html_id'               => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
575
-                'html_class'            => 'spco-next-step-btn',
576
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
577
-                'default'               => $this->submit_button_text(),
578
-            ]
579
-        );
580
-        $submit_btn->set_button_css_attributes(true, 'large');
581
-        $submit_btn_html = $submit_btn->get_html_for_input();
582
-        $html            .= EEH_HTML::div(
583
-            apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $submit_btn_html, $this),
584
-            'spco-' . $this->slug() . '-whats-next-buttons-dv',
585
-            'spco-whats-next-buttons'
586
-        );
587
-        return $html;
588
-    }
589
-
590
-
591
-    /**
592
-     * div_class - returns nothing for current step, but a css class of "hidden" for others
593
-     *
594
-     * @return string
595
-     */
596
-    public function div_class()
597
-    {
598
-        return $this->is_current_step() ? '' : ' hidden';
599
-    }
600
-
601
-
602
-    /**
603
-     * div_class - returns  a css class of "hidden" for current step, but nothing for others
604
-     *
605
-     * @return string
606
-     */
607
-    public function edit_lnk_url()
608
-    {
609
-        return add_query_arg(['step' => $this->slug()], $this->checkout->reg_page_base_url);
610
-    }
611
-
612
-
613
-    /**
614
-     * div_class - returns  a css class of "hidden" for current step, but nothing for others
615
-     *
616
-     * @return string
617
-     */
618
-    public function edit_link_class()
619
-    {
620
-        return $this->is_current_step() ? ' hidden' : '';
621
-    }
622
-
623
-
624
-    /**
625
-     * update_checkout with changes that have been made to the cart
626
-     *
627
-     * @return void
628
-     * @throws EE_Error
629
-     * @throws ReflectionException
630
-     */
631
-    public function update_checkout()
632
-    {
633
-        // grab the cart grand total and reset TXN total
634
-        $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());
635
-        $this->checkout->stash_transaction_and_checkout();
636
-    }
637
-
638
-
639
-    /**
640
-     *    __sleep
641
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon
642
-     * serialization EE_Checkout will handle the reimplementation of itself upon waking, but we won't bother with the
643
-     * reg form, because if needed, it will be regenerated anyways
644
-     *
645
-     * @return array
646
-     */
647
-    public function __sleep()
648
-    {
649
-        // remove the reg form and the checkout
650
-        return array_diff(array_keys(get_object_vars($this)), ['reg_form', 'checkout']);
651
-    }
652
-
653
-
654
-    /**
655
-     * @param RequestInterface $request
656
-     */
657
-    public function setRequest(RequestInterface $request)
658
-    {
659
-        $this->request = $request;
660
-    }
17
+	/**
18
+	 *    $_completed - TRUE if this step has fully completed it's duties
19
+	 *
20
+	 * @access protected
21
+	 * @type bool $_completed
22
+	 */
23
+	protected $_completed = false;
24
+
25
+	/**
26
+	 *    $_is_current_step - TRUE if this is the current step
27
+	 *
28
+	 * @access protected
29
+	 * @type bool $_is_current_step
30
+	 */
31
+	protected $_is_current_step = false;
32
+
33
+	/**
34
+	 *    $_order - when the reg step should be run relative to other steps
35
+	 *
36
+	 * @access protected
37
+	 * @type int $_template
38
+	 */
39
+	protected $_order = 0;
40
+
41
+	/**
42
+	 *    $_slug - URL param for this step
43
+	 *
44
+	 * @access protected
45
+	 * @type string $_slug
46
+	 */
47
+	protected $_slug;
48
+
49
+	/**
50
+	 *    $_name - Step Name - translatable string
51
+	 *
52
+	 * @access protected
53
+	 * @type string $_slug
54
+	 */
55
+	protected $_name;
56
+
57
+	/**
58
+	 *    $_submit_button_text - translatable string that appears on this step's submit button
59
+	 *
60
+	 * @access protected
61
+	 * @type string $_slug
62
+	 */
63
+	protected $_submit_button_text;
64
+
65
+	/**
66
+	 *    $_template - template name
67
+	 *
68
+	 * @access protected
69
+	 * @type string $_template
70
+	 */
71
+	protected $_template;
72
+
73
+	/**
74
+	 *    $_reg_form_name - the form input name and id attribute
75
+	 *
76
+	 * @access protected
77
+	 * @var string $_reg_form_name
78
+	 */
79
+	protected $_reg_form_name;
80
+
81
+	/**
82
+	 *    $_success_message - text to display upon successful form submission
83
+	 *
84
+	 * @access private
85
+	 * @var string $_success_message
86
+	 */
87
+	protected $_success_message;
88
+
89
+	/**
90
+	 *    $_instructions - a brief description of how to complete the reg step.
91
+	 *    Usually displayed in conjunction with the previous step's success message.
92
+	 *
93
+	 * @access private
94
+	 * @var string $_instructions
95
+	 */
96
+	protected $_instructions;
97
+
98
+	/**
99
+	 *    $_valid_data - the normalized and validated data for this step
100
+	 *
101
+	 * @access public
102
+	 * @var array $_valid_data
103
+	 */
104
+	protected $_valid_data = [];
105
+
106
+	/**
107
+	 *    $reg_form - the registration form for this step
108
+	 *
109
+	 * @access public
110
+	 * @var EE_Form_Section_Proper $reg_form
111
+	 */
112
+	public $reg_form;
113
+
114
+	/**
115
+	 *    $checkout - EE_Checkout object for handling the properties of the current checkout process
116
+	 *
117
+	 * @access public
118
+	 * @var EE_Checkout $checkout
119
+	 */
120
+	public $checkout;
121
+
122
+	/**
123
+	 * @var RequestInterface $request
124
+	 */
125
+	protected $request;
126
+
127
+
128
+	/**
129
+	 * @return void
130
+	 */
131
+	abstract public function translate_js_strings();
132
+
133
+
134
+	/**
135
+	 * @return void
136
+	 */
137
+	abstract public function enqueue_styles_and_scripts();
138
+
139
+
140
+	/**
141
+	 * @return boolean
142
+	 */
143
+	abstract public function initialize_reg_step();
144
+
145
+
146
+	/**
147
+	 * @return string
148
+	 */
149
+	abstract public function generate_reg_form();
150
+
151
+
152
+	/**
153
+	 * @return boolean
154
+	 */
155
+	abstract public function process_reg_step();
156
+
157
+
158
+	/**
159
+	 * @return boolean
160
+	 */
161
+	abstract public function update_reg_step();
162
+
163
+
164
+	/**
165
+	 * @return boolean
166
+	 */
167
+	public function completed()
168
+	{
169
+		return $this->_completed;
170
+	}
171
+
172
+
173
+	/**
174
+	 * set_completed - toggles $_completed to TRUE
175
+	 */
176
+	public function set_completed()
177
+	{
178
+		// DEBUG LOG
179
+		// $this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
180
+		$this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this);
181
+	}
182
+
183
+
184
+	/**
185
+	 * set_completed - toggles $_completed to FALSE
186
+	 */
187
+	public function set_not_completed()
188
+	{
189
+		$this->_completed = false;
190
+	}
191
+
192
+
193
+	/**
194
+	 * @return string
195
+	 */
196
+	public function name()
197
+	{
198
+		return $this->_name;
199
+	}
200
+
201
+
202
+	/**
203
+	 * @return string
204
+	 */
205
+	public function slug()
206
+	{
207
+		return $this->_slug;
208
+	}
209
+
210
+
211
+	/**
212
+	 * submit_button_text
213
+	 * the text that appears on the reg step form submit button
214
+	 *
215
+	 * @return string
216
+	 */
217
+	public function submit_button_text()
218
+	{
219
+		return $this->_submit_button_text;
220
+	}
221
+
222
+
223
+	/**
224
+	 * set_submit_button_text
225
+	 * sets the text that appears on the reg step form submit button
226
+	 *
227
+	 * @param string $submit_button_text
228
+	 */
229
+	public function set_submit_button_text($submit_button_text = '')
230
+	{
231
+		if (! empty($submit_button_text)) {
232
+			$this->_submit_button_text = $submit_button_text;
233
+		} elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
234
+			if ($this->checkout->revisit) {
235
+				$this->_submit_button_text = sprintf(
236
+					esc_html__('Update %s', 'event_espresso'),
237
+					$this->checkout->current_step->name()
238
+				);
239
+			} else {
240
+				$this->_submit_button_text = sprintf(
241
+					esc_html__('Proceed to %s', 'event_espresso'),
242
+					$this->checkout->next_step->name()
243
+				);
244
+			}
245
+		}
246
+		// filters the submit button text
247
+		$this->_submit_button_text = apply_filters(
248
+			'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
249
+			$this->_submit_button_text,
250
+			$this->checkout
251
+		);
252
+	}
253
+
254
+
255
+	/**
256
+	 * @param boolean $is_current_step
257
+	 */
258
+	public function set_is_current_step($is_current_step)
259
+	{
260
+		$this->_is_current_step = $is_current_step;
261
+	}
262
+
263
+
264
+	/**
265
+	 * @return boolean
266
+	 */
267
+	public function is_current_step()
268
+	{
269
+		return $this->_is_current_step;
270
+	}
271
+
272
+
273
+	/**
274
+	 * @return boolean
275
+	 */
276
+	public function is_final_step()
277
+	{
278
+		return $this instanceof EE_SPCO_Reg_Step_Finalize_Registration;
279
+	}
280
+
281
+
282
+	/**
283
+	 * @param int $order
284
+	 */
285
+	public function set_order($order)
286
+	{
287
+		$this->_order = $order;
288
+	}
289
+
290
+
291
+	/**
292
+	 * @return int
293
+	 */
294
+	public function order()
295
+	{
296
+		return $this->_order;
297
+	}
298
+
299
+
300
+	/**
301
+	 * @return string
302
+	 */
303
+	public function template()
304
+	{
305
+		return $this->_template;
306
+	}
307
+
308
+
309
+	/**
310
+	 * @return string
311
+	 */
312
+	public function success_message()
313
+	{
314
+		return $this->_success_message;
315
+	}
316
+
317
+
318
+	/**
319
+	 * _set_success_message
320
+	 *
321
+	 * @param string $success_message
322
+	 */
323
+	protected function _set_success_message($success_message)
324
+	{
325
+		$this->_success_message = $success_message;
326
+	}
327
+
328
+
329
+	/**
330
+	 * _reset_success_message
331
+	 *
332
+	 * @return void
333
+	 */
334
+	protected function _reset_success_message()
335
+	{
336
+		$this->_success_message = '';
337
+	}
338
+
339
+
340
+	/**
341
+	 * @return string
342
+	 */
343
+	public function _instructions()
344
+	{
345
+		return $this->_instructions;
346
+	}
347
+
348
+
349
+	/**
350
+	 * @param string $instructions
351
+	 */
352
+	public function set_instructions($instructions)
353
+	{
354
+		$this->_instructions = apply_filters(
355
+			'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions',
356
+			$instructions,
357
+			$this
358
+		);
359
+	}
360
+
361
+
362
+	/**
363
+	 * @param array $valid_data
364
+	 */
365
+	public function set_valid_data($valid_data)
366
+	{
367
+		$this->_valid_data = $valid_data;
368
+	}
369
+
370
+
371
+	/**
372
+	 * @return array
373
+	 * @throws EE_Error
374
+	 * @throws EE_Error
375
+	 */
376
+	public function valid_data()
377
+	{
378
+		if (empty($this->_valid_data)) {
379
+			$this->_valid_data = $this->reg_form->valid_data();
380
+		}
381
+		return $this->_valid_data;
382
+	}
383
+
384
+
385
+	/**
386
+	 * @return string
387
+	 */
388
+	public function reg_form_name()
389
+	{
390
+		if (empty($this->_reg_form_name)) {
391
+			$this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form');
392
+		}
393
+		return $this->_reg_form_name;
394
+	}
395
+
396
+
397
+	/**
398
+	 * @param string $reg_form_name
399
+	 */
400
+	protected function set_reg_form_name($reg_form_name)
401
+	{
402
+		$this->_reg_form_name = $reg_form_name;
403
+	}
404
+
405
+
406
+	/**
407
+	 * reg_step_url
408
+	 *
409
+	 * @param string $action
410
+	 * @return string
411
+	 */
412
+	public function reg_step_url($action = '')
413
+	{
414
+		$query_args = ['step' => $this->slug()];
415
+		if (! empty($action)) {
416
+			$query_args['action'] = $action;
417
+		}
418
+		// final step has no display
419
+		if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') {
420
+			$query_args['action'] = 'process_reg_step';
421
+		}
422
+		if ($this->checkout->revisit) {
423
+			$query_args['revisit'] = true;
424
+		}
425
+		if ($this->checkout->reg_url_link) {
426
+			$query_args['e_reg_url_link'] = $this->checkout->reg_url_link;
427
+		}
428
+		return add_query_arg($query_args, $this->checkout->reg_page_base_url);
429
+	}
430
+
431
+
432
+	/**
433
+	 * creates the default hidden inputs section
434
+	 *
435
+	 * @return EE_Form_Section_Proper
436
+	 * @throws EE_Error
437
+	 */
438
+	public function reg_step_hidden_inputs()
439
+	{
440
+		// hidden inputs for admin registrations
441
+		if ($this->checkout->admin_request) {
442
+			return new EE_Form_Section_Proper(
443
+				[
444
+					'layout_strategy' => new EE_Div_Per_Section_Layout(),
445
+					'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
446
+					'subsections'     => [
447
+						'next_step' => new EE_Fixed_Hidden_Input(
448
+							[
449
+								'html_name' => 'next_step',
450
+								'html_id'   => 'spco-' . $this->slug() . '-next-step',
451
+								'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
452
+									? $this->checkout->next_step->slug()
453
+									: '',
454
+							]
455
+						),
456
+					],
457
+				]
458
+			);
459
+		}
460
+		// hidden inputs for frontend registrations
461
+		return new EE_Form_Section_Proper(
462
+			[
463
+				'layout_strategy' => new EE_Div_Per_Section_Layout(),
464
+				'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
465
+				'subsections'     => [
466
+					'action'         => new EE_Fixed_Hidden_Input(
467
+						[
468
+							'html_name' => 'action',
469
+							'html_id'   => 'spco-' . $this->slug() . '-action',
470
+							'default'   => apply_filters(
471
+								'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',
472
+								empty($this->checkout->reg_url_link)
473
+									? 'process_reg_step'
474
+									: 'update_reg_step',
475
+								$this
476
+							),
477
+						]
478
+					),
479
+					'next_step'      => new EE_Fixed_Hidden_Input(
480
+						[
481
+							'html_name' => 'next_step',
482
+							'html_id'   => 'spco-' . $this->slug() . '-next-step',
483
+							'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
484
+								? $this->checkout->next_step->slug()
485
+								: '',
486
+						]
487
+					),
488
+					'e_reg_url_link' => new EE_Fixed_Hidden_Input(
489
+						[
490
+							'html_name' => 'e_reg_url_link',
491
+							'html_id'   => 'spco-reg_url_link',
492
+							'default'   => $this->checkout->reg_url_link,
493
+						]
494
+					),
495
+					'revisit'        => new EE_Fixed_Hidden_Input(
496
+						[
497
+							'html_name' => 'revisit',
498
+							'html_id'   => 'spco-revisit',
499
+							'default'   => $this->checkout->revisit,
500
+						]
501
+					),
502
+				],
503
+			]
504
+		);
505
+	}
506
+
507
+
508
+	/**
509
+	 * generate_reg_form_for_actions
510
+	 *
511
+	 * @param array $actions
512
+	 * @return void
513
+	 */
514
+	public function generate_reg_form_for_actions($actions = [])
515
+	{
516
+		$actions                           = array_merge(
517
+			[
518
+				'generate_reg_form',
519
+				'display_spco_reg_step',
520
+				'process_reg_step',
521
+				'update_reg_step',
522
+			],
523
+			$actions
524
+		);
525
+		$this->checkout->generate_reg_form = in_array($this->checkout->action, $actions, true);
526
+	}
527
+
528
+
529
+	/**
530
+	 * @return string
531
+	 * @throws EE_Error
532
+	 */
533
+	public function display_reg_form()
534
+	{
535
+		$html = '';
536
+		if ($this->reg_form instanceof EE_Form_Section_Proper) {
537
+			do_action('AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', $this->reg_form, $this);
538
+			$html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';
539
+			if ($this->request->isAjax()) {
540
+				$this->reg_form->localize_validation_rules();
541
+				$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
542
+			}
543
+			$html .= $this->reg_form->get_html();
544
+			$html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : '';
545
+			$html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : '';
546
+		}
547
+		return $html;
548
+	}
549
+
550
+
551
+	/**
552
+	 * div_class - returns nothing for current step, but a css class of "hidden" for others
553
+	 *
554
+	 * @return string
555
+	 * @throws EE_Error
556
+	 */
557
+	public function reg_step_submit_button()
558
+	{
559
+		if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
560
+			return '';
561
+		}
562
+		ob_start();
563
+		do_action(
564
+			'AHEE__before_spco_whats_next_buttons',
565
+			$this->slug(),
566
+			$this->checkout->next_step->slug(),
567
+			$this->checkout
568
+		);
569
+		$html = ob_get_clean();
570
+		// generate submit button
571
+		$submit_btn = new EE_Submit_Input(
572
+			[
573
+				'html_name'             => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
574
+				'html_id'               => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
575
+				'html_class'            => 'spco-next-step-btn',
576
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
577
+				'default'               => $this->submit_button_text(),
578
+			]
579
+		);
580
+		$submit_btn->set_button_css_attributes(true, 'large');
581
+		$submit_btn_html = $submit_btn->get_html_for_input();
582
+		$html            .= EEH_HTML::div(
583
+			apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $submit_btn_html, $this),
584
+			'spco-' . $this->slug() . '-whats-next-buttons-dv',
585
+			'spco-whats-next-buttons'
586
+		);
587
+		return $html;
588
+	}
589
+
590
+
591
+	/**
592
+	 * div_class - returns nothing for current step, but a css class of "hidden" for others
593
+	 *
594
+	 * @return string
595
+	 */
596
+	public function div_class()
597
+	{
598
+		return $this->is_current_step() ? '' : ' hidden';
599
+	}
600
+
601
+
602
+	/**
603
+	 * div_class - returns  a css class of "hidden" for current step, but nothing for others
604
+	 *
605
+	 * @return string
606
+	 */
607
+	public function edit_lnk_url()
608
+	{
609
+		return add_query_arg(['step' => $this->slug()], $this->checkout->reg_page_base_url);
610
+	}
611
+
612
+
613
+	/**
614
+	 * div_class - returns  a css class of "hidden" for current step, but nothing for others
615
+	 *
616
+	 * @return string
617
+	 */
618
+	public function edit_link_class()
619
+	{
620
+		return $this->is_current_step() ? ' hidden' : '';
621
+	}
622
+
623
+
624
+	/**
625
+	 * update_checkout with changes that have been made to the cart
626
+	 *
627
+	 * @return void
628
+	 * @throws EE_Error
629
+	 * @throws ReflectionException
630
+	 */
631
+	public function update_checkout()
632
+	{
633
+		// grab the cart grand total and reset TXN total
634
+		$this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());
635
+		$this->checkout->stash_transaction_and_checkout();
636
+	}
637
+
638
+
639
+	/**
640
+	 *    __sleep
641
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon
642
+	 * serialization EE_Checkout will handle the reimplementation of itself upon waking, but we won't bother with the
643
+	 * reg form, because if needed, it will be regenerated anyways
644
+	 *
645
+	 * @return array
646
+	 */
647
+	public function __sleep()
648
+	{
649
+		// remove the reg form and the checkout
650
+		return array_diff(array_keys(get_object_vars($this)), ['reg_form', 'checkout']);
651
+	}
652
+
653
+
654
+	/**
655
+	 * @param RequestInterface $request
656
+	 */
657
+	public function setRequest(RequestInterface $request)
658
+	{
659
+		$this->request = $request;
660
+	}
661 661
 }
Please login to merge, or discard this patch.
core/services/container/RegistryContainer.php 2 patches
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -17,165 +17,165 @@
 block discarded – undo
17 17
 class RegistryContainer implements ArrayAccess, CountableTraversableAggregate
18 18
 {
19 19
 
20
-    /**
21
-     * @var array $container
22
-     */
23
-    private $container = [];
24
-
25
-    /**
26
-     * RegistryContainer constructor.
27
-     * Container data can be seeded by passing parameters to constructor.
28
-     * Each parameter will become its own element in the container
29
-     */
30
-    public function __construct()
31
-    {
32
-    }
33
-
34
-
35
-    /**
36
-     * @param mixed $offset
37
-     * @param mixed $value
38
-     */
39
-    public function offsetSet($offset, $value)
40
-    {
41
-        $this->container[ $offset ] = $value;
42
-    }
43
-
44
-
45
-    /**
46
-     * @param mixed $offset
47
-     * @return bool
48
-     */
49
-    public function offsetExists($offset)
50
-    {
51
-        return isset($this->container[ $offset ]);
52
-    }
53
-
54
-
55
-    /**
56
-     * @param mixed $offset
57
-     */
58
-    public function offsetUnset($offset)
59
-    {
60
-        unset($this->container[ $offset ]);
61
-    }
62
-
63
-
64
-    /**
65
-     * @param mixed $offset
66
-     * @return mixed|null
67
-     */
68
-    public function offsetGet($offset)
69
-    {
70
-        return $this->offsetExists($offset) ? $this->container[ $offset ] : null;
71
-    }
72
-
73
-
74
-    /**
75
-     * @return int
76
-     */
77
-    public function count()
78
-    {
79
-        return count($this->container);
80
-    }
81
-
82
-
83
-    /**
84
-     * @return ArrayIterator
85
-     */
86
-    public function getIterator()
87
-    {
88
-        return new ArrayIterator($this->container);
89
-    }
90
-
91
-
92
-    /**
93
-     * @param $offset
94
-     * @param $value
95
-     */
96
-    public function __set($offset, $value)
97
-    {
98
-        $this->offsetSet($offset, $value);
99
-    }
100
-
101
-
102
-    /**
103
-     * @param $offset
104
-     * @return mixed
105
-     * @throws OutOfBoundsException
106
-     */
107
-    public function __get($offset)
108
-    {
109
-        if (! array_key_exists($offset, $this->container)) {
110
-            $trace = debug_backtrace();
111
-            throw new OutOfBoundsException(
112
-                sprintf(
113
-                    esc_html__('Invalid offset: %1$s %2$sCalled from %3$s on line %4$d', 'event_espresso'),
114
-                    $offset,
115
-                    '<br  />',
116
-                    $trace[0]['file'],
117
-                    $trace[0]['line']
118
-                )
119
-            );
120
-        }
121
-        return $this->offsetGet($offset);
122
-    }
123
-
124
-
125
-    /**
126
-     * @param $offset
127
-     * @return bool
128
-     */
129
-    public function __isset($offset)
130
-    {
131
-        return $this->offsetExists($offset);
132
-    }
133
-
134
-
135
-    /**
136
-     * @param $offset
137
-     */
138
-    public function __unset($offset)
139
-    {
140
-        $this->offsetUnset($offset);
141
-    }
142
-
143
-
144
-    /**
145
-     * @param $offset
146
-     * @param $value
147
-     */
148
-    public function add($offset, $value)
149
-    {
150
-        $this->offsetSet($offset, $value);
151
-    }
152
-
153
-
154
-    /**
155
-     * @param $offset
156
-     */
157
-    public function remove($offset)
158
-    {
159
-        $this->offsetUnset($offset);
160
-    }
161
-
162
-
163
-    /**
164
-     * @param $offset
165
-     * @return bool
166
-     */
167
-    public function has($offset)
168
-    {
169
-        return $this->offsetExists($offset);
170
-    }
171
-
172
-
173
-    /**
174
-     * @param $offset
175
-     * @return mixed|null
176
-     */
177
-    public function get($offset)
178
-    {
179
-        return $this->offsetGet($offset);
180
-    }
20
+	/**
21
+	 * @var array $container
22
+	 */
23
+	private $container = [];
24
+
25
+	/**
26
+	 * RegistryContainer constructor.
27
+	 * Container data can be seeded by passing parameters to constructor.
28
+	 * Each parameter will become its own element in the container
29
+	 */
30
+	public function __construct()
31
+	{
32
+	}
33
+
34
+
35
+	/**
36
+	 * @param mixed $offset
37
+	 * @param mixed $value
38
+	 */
39
+	public function offsetSet($offset, $value)
40
+	{
41
+		$this->container[ $offset ] = $value;
42
+	}
43
+
44
+
45
+	/**
46
+	 * @param mixed $offset
47
+	 * @return bool
48
+	 */
49
+	public function offsetExists($offset)
50
+	{
51
+		return isset($this->container[ $offset ]);
52
+	}
53
+
54
+
55
+	/**
56
+	 * @param mixed $offset
57
+	 */
58
+	public function offsetUnset($offset)
59
+	{
60
+		unset($this->container[ $offset ]);
61
+	}
62
+
63
+
64
+	/**
65
+	 * @param mixed $offset
66
+	 * @return mixed|null
67
+	 */
68
+	public function offsetGet($offset)
69
+	{
70
+		return $this->offsetExists($offset) ? $this->container[ $offset ] : null;
71
+	}
72
+
73
+
74
+	/**
75
+	 * @return int
76
+	 */
77
+	public function count()
78
+	{
79
+		return count($this->container);
80
+	}
81
+
82
+
83
+	/**
84
+	 * @return ArrayIterator
85
+	 */
86
+	public function getIterator()
87
+	{
88
+		return new ArrayIterator($this->container);
89
+	}
90
+
91
+
92
+	/**
93
+	 * @param $offset
94
+	 * @param $value
95
+	 */
96
+	public function __set($offset, $value)
97
+	{
98
+		$this->offsetSet($offset, $value);
99
+	}
100
+
101
+
102
+	/**
103
+	 * @param $offset
104
+	 * @return mixed
105
+	 * @throws OutOfBoundsException
106
+	 */
107
+	public function __get($offset)
108
+	{
109
+		if (! array_key_exists($offset, $this->container)) {
110
+			$trace = debug_backtrace();
111
+			throw new OutOfBoundsException(
112
+				sprintf(
113
+					esc_html__('Invalid offset: %1$s %2$sCalled from %3$s on line %4$d', 'event_espresso'),
114
+					$offset,
115
+					'<br  />',
116
+					$trace[0]['file'],
117
+					$trace[0]['line']
118
+				)
119
+			);
120
+		}
121
+		return $this->offsetGet($offset);
122
+	}
123
+
124
+
125
+	/**
126
+	 * @param $offset
127
+	 * @return bool
128
+	 */
129
+	public function __isset($offset)
130
+	{
131
+		return $this->offsetExists($offset);
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param $offset
137
+	 */
138
+	public function __unset($offset)
139
+	{
140
+		$this->offsetUnset($offset);
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param $offset
146
+	 * @param $value
147
+	 */
148
+	public function add($offset, $value)
149
+	{
150
+		$this->offsetSet($offset, $value);
151
+	}
152
+
153
+
154
+	/**
155
+	 * @param $offset
156
+	 */
157
+	public function remove($offset)
158
+	{
159
+		$this->offsetUnset($offset);
160
+	}
161
+
162
+
163
+	/**
164
+	 * @param $offset
165
+	 * @return bool
166
+	 */
167
+	public function has($offset)
168
+	{
169
+		return $this->offsetExists($offset);
170
+	}
171
+
172
+
173
+	/**
174
+	 * @param $offset
175
+	 * @return mixed|null
176
+	 */
177
+	public function get($offset)
178
+	{
179
+		return $this->offsetGet($offset);
180
+	}
181 181
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function offsetSet($offset, $value)
40 40
     {
41
-        $this->container[ $offset ] = $value;
41
+        $this->container[$offset] = $value;
42 42
     }
43 43
 
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function offsetExists($offset)
50 50
     {
51
-        return isset($this->container[ $offset ]);
51
+        return isset($this->container[$offset]);
52 52
     }
53 53
 
54 54
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function offsetUnset($offset)
59 59
     {
60
-        unset($this->container[ $offset ]);
60
+        unset($this->container[$offset]);
61 61
     }
62 62
 
63 63
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function offsetGet($offset)
69 69
     {
70
-        return $this->offsetExists($offset) ? $this->container[ $offset ] : null;
70
+        return $this->offsetExists($offset) ? $this->container[$offset] : null;
71 71
     }
72 72
 
73 73
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function __get($offset)
108 108
     {
109
-        if (! array_key_exists($offset, $this->container)) {
109
+        if ( ! array_key_exists($offset, $this->container)) {
110 110
             $trace = debug_backtrace();
111 111
             throw new OutOfBoundsException(
112 112
                 sprintf(
Please login to merge, or discard this patch.
core/services/loaders/Loader.php 1 patch
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -15,127 +15,127 @@
 block discarded – undo
15 15
 class Loader implements LoaderInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @var LoaderDecoratorInterface $new_loader
20
-     */
21
-    private $new_loader;
22
-
23
-    /**
24
-     * @var LoaderDecoratorInterface $shared_loader
25
-     */
26
-    private $shared_loader;
27
-
28
-    /**
29
-     * @var ClassInterfaceCache $class_cache
30
-     */
31
-    private $class_cache;
32
-
33
-    /**
34
-     * Loader constructor.
35
-     *
36
-     * @param LoaderDecoratorInterface        $new_loader
37
-     * @param CachingLoaderDecoratorInterface $shared_loader
38
-     * @param ClassInterfaceCache             $class_cache
39
-     */
40
-    public function __construct(
41
-        LoaderDecoratorInterface $new_loader,
42
-        CachingLoaderDecoratorInterface $shared_loader,
43
-        ClassInterfaceCache $class_cache
44
-    ) {
45
-        $this->new_loader    = $new_loader;
46
-        $this->shared_loader = $shared_loader;
47
-        $this->class_cache   = $class_cache;
48
-    }
49
-
50
-
51
-    /**
52
-     * @return LoaderDecoratorInterface
53
-     */
54
-    public function getNewLoader()
55
-    {
56
-        return $this->new_loader;
57
-    }
58
-
59
-
60
-    /**
61
-     * @return CachingLoaderDecoratorInterface
62
-     */
63
-    public function getSharedLoader()
64
-    {
65
-        return $this->shared_loader;
66
-    }
67
-
68
-
69
-    /**
70
-     * @param FullyQualifiedName|string $fqcn
71
-     * @param array                     $arguments
72
-     * @param bool                      $shared
73
-     * @return mixed
74
-     */
75
-    public function load($fqcn, array $arguments = array(), $shared = true)
76
-    {
77
-        $fqcn = $this->class_cache->getFqn($fqcn);
78
-        if ($this->class_cache->hasInterface($fqcn, 'EventEspresso\core\interfaces\ReservedInstanceInterface')) {
79
-            $shared = true;
80
-        }
81
-        return $shared
82
-            ? $this->getSharedLoader()->load($fqcn, $arguments, $shared)
83
-            : $this->getNewLoader()->load($fqcn, $arguments, $shared);
84
-    }
85
-
86
-
87
-    /**
88
-     * @param FullyQualifiedName|string $fqcn
89
-     * @param array                     $arguments
90
-     * @return mixed
91
-     */
92
-    public function getNew($fqcn, array $arguments = array())
93
-    {
94
-        return $this->load($fqcn, $arguments, false);
95
-    }
96
-
97
-
98
-    /**
99
-     * @param FullyQualifiedName|string $fqcn
100
-     * @param array                     $arguments
101
-     * @return mixed
102
-     */
103
-    public function getShared($fqcn, array $arguments = array())
104
-    {
105
-        return $this->load($fqcn, $arguments);
106
-    }
107
-
108
-
109
-    /**
110
-     * @param FullyQualifiedName|string $fqcn
111
-     * @param mixed                     $object
112
-     * @return bool
113
-     * @throws InvalidArgumentException
114
-     */
115
-    public function share($fqcn, $object)
116
-    {
117
-        $fqcn = $this->class_cache->getFqn($fqcn);
118
-        return $this->getSharedLoader()->share($fqcn, $object);
119
-    }
120
-
121
-
122
-    /**
123
-     * @param FullyQualifiedName|string $fqcn
124
-     * @return bool
125
-     * @throws InvalidArgumentException
126
-     */
127
-    public function remove($fqcn, array $arguments = [])
128
-    {
129
-        $fqcn = $this->class_cache->getFqn($fqcn);
130
-        return $this->getSharedLoader()->remove($fqcn, $arguments);
131
-    }
132
-
133
-
134
-    /**
135
-     * calls reset() on loaders if that method exists
136
-     */
137
-    public function reset()
138
-    {
139
-        $this->shared_loader->reset();
140
-    }
18
+	/**
19
+	 * @var LoaderDecoratorInterface $new_loader
20
+	 */
21
+	private $new_loader;
22
+
23
+	/**
24
+	 * @var LoaderDecoratorInterface $shared_loader
25
+	 */
26
+	private $shared_loader;
27
+
28
+	/**
29
+	 * @var ClassInterfaceCache $class_cache
30
+	 */
31
+	private $class_cache;
32
+
33
+	/**
34
+	 * Loader constructor.
35
+	 *
36
+	 * @param LoaderDecoratorInterface        $new_loader
37
+	 * @param CachingLoaderDecoratorInterface $shared_loader
38
+	 * @param ClassInterfaceCache             $class_cache
39
+	 */
40
+	public function __construct(
41
+		LoaderDecoratorInterface $new_loader,
42
+		CachingLoaderDecoratorInterface $shared_loader,
43
+		ClassInterfaceCache $class_cache
44
+	) {
45
+		$this->new_loader    = $new_loader;
46
+		$this->shared_loader = $shared_loader;
47
+		$this->class_cache   = $class_cache;
48
+	}
49
+
50
+
51
+	/**
52
+	 * @return LoaderDecoratorInterface
53
+	 */
54
+	public function getNewLoader()
55
+	{
56
+		return $this->new_loader;
57
+	}
58
+
59
+
60
+	/**
61
+	 * @return CachingLoaderDecoratorInterface
62
+	 */
63
+	public function getSharedLoader()
64
+	{
65
+		return $this->shared_loader;
66
+	}
67
+
68
+
69
+	/**
70
+	 * @param FullyQualifiedName|string $fqcn
71
+	 * @param array                     $arguments
72
+	 * @param bool                      $shared
73
+	 * @return mixed
74
+	 */
75
+	public function load($fqcn, array $arguments = array(), $shared = true)
76
+	{
77
+		$fqcn = $this->class_cache->getFqn($fqcn);
78
+		if ($this->class_cache->hasInterface($fqcn, 'EventEspresso\core\interfaces\ReservedInstanceInterface')) {
79
+			$shared = true;
80
+		}
81
+		return $shared
82
+			? $this->getSharedLoader()->load($fqcn, $arguments, $shared)
83
+			: $this->getNewLoader()->load($fqcn, $arguments, $shared);
84
+	}
85
+
86
+
87
+	/**
88
+	 * @param FullyQualifiedName|string $fqcn
89
+	 * @param array                     $arguments
90
+	 * @return mixed
91
+	 */
92
+	public function getNew($fqcn, array $arguments = array())
93
+	{
94
+		return $this->load($fqcn, $arguments, false);
95
+	}
96
+
97
+
98
+	/**
99
+	 * @param FullyQualifiedName|string $fqcn
100
+	 * @param array                     $arguments
101
+	 * @return mixed
102
+	 */
103
+	public function getShared($fqcn, array $arguments = array())
104
+	{
105
+		return $this->load($fqcn, $arguments);
106
+	}
107
+
108
+
109
+	/**
110
+	 * @param FullyQualifiedName|string $fqcn
111
+	 * @param mixed                     $object
112
+	 * @return bool
113
+	 * @throws InvalidArgumentException
114
+	 */
115
+	public function share($fqcn, $object)
116
+	{
117
+		$fqcn = $this->class_cache->getFqn($fqcn);
118
+		return $this->getSharedLoader()->share($fqcn, $object);
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param FullyQualifiedName|string $fqcn
124
+	 * @return bool
125
+	 * @throws InvalidArgumentException
126
+	 */
127
+	public function remove($fqcn, array $arguments = [])
128
+	{
129
+		$fqcn = $this->class_cache->getFqn($fqcn);
130
+		return $this->getSharedLoader()->remove($fqcn, $arguments);
131
+	}
132
+
133
+
134
+	/**
135
+	 * calls reset() on loaders if that method exists
136
+	 */
137
+	public function reset()
138
+	{
139
+		$this->shared_loader->reset();
140
+	}
141 141
 }
Please login to merge, or discard this patch.