Completed
Branch EE5Update (bc64e6)
by
unknown
09:36 queued 05:38
created
modules/events_archive/EventsArchiveIframe.php 2 patches
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.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -21,58 +21,58 @@
 block discarded – undo
21 21
  */
22 22
 class EventsArchiveIframe extends Iframe
23 23
 {
24
-    /**
25
-     * EventsArchiveIframe constructor.
26
-     *
27
-     * @param EED_Events_Archive $EED_Events_Archive
28
-     * @throws EE_Error
29
-     * @throws ReflectionException
30
-     */
31
-    public function __construct($EED_Events_Archive)
32
-    {
33
-        /** @var CurrentPage $current_page */
34
-        $current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
35
-        $current_page->setEspressoPage(true);
36
-        add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
37
-        $EED_Events_Archive->event_list();
38
-        /** @var EspressoEvents $event_list */
39
-        $event_list = EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents');
40
-        parent::__construct(
41
-            esc_html__('Event List', 'event_espresso'),
42
-            $event_list->processShortcode()
43
-        );
44
-        $this->addStylesheets(
45
-            apply_filters(
46
-                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
47
-                [
48
-                    'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
49
-                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
50
-                        : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
51
-                ],
52
-                $this
53
-            )
54
-        );
55
-        $this->addScripts(
56
-            apply_filters(
57
-                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
58
-                [
59
-                    'gmap_api' => sprintf(
60
-                        'https://maps.googleapis.com/maps/api/js?key=%s',
61
-                        apply_filters(
62
-                            'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
63
-                            EE_Registry::instance()->CFG->map_settings->google_map_api_key
64
-                        )
65
-                    ),
66
-                    'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
67
-                ],
68
-                $this
69
-            )
70
-        );
71
-        $this->addLocalizedVars(
72
-            [
73
-                'ee_gmap' => EEH_Maps::$gmap_vars,
74
-            ],
75
-            'ee_gmap_vars'
76
-        );
77
-    }
24
+	/**
25
+	 * EventsArchiveIframe constructor.
26
+	 *
27
+	 * @param EED_Events_Archive $EED_Events_Archive
28
+	 * @throws EE_Error
29
+	 * @throws ReflectionException
30
+	 */
31
+	public function __construct($EED_Events_Archive)
32
+	{
33
+		/** @var CurrentPage $current_page */
34
+		$current_page = LoaderFactory::getLoader()->getShared(CurrentPage::class);
35
+		$current_page->setEspressoPage(true);
36
+		add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
37
+		$EED_Events_Archive->event_list();
38
+		/** @var EspressoEvents $event_list */
39
+		$event_list = EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents');
40
+		parent::__construct(
41
+			esc_html__('Event List', 'event_espresso'),
42
+			$event_list->processShortcode()
43
+		);
44
+		$this->addStylesheets(
45
+			apply_filters(
46
+				'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
47
+				[
48
+					'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
49
+						? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
50
+						: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
51
+				],
52
+				$this
53
+			)
54
+		);
55
+		$this->addScripts(
56
+			apply_filters(
57
+				'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
58
+				[
59
+					'gmap_api' => sprintf(
60
+						'https://maps.googleapis.com/maps/api/js?key=%s',
61
+						apply_filters(
62
+							'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
63
+							EE_Registry::instance()->CFG->map_settings->google_map_api_key
64
+						)
65
+					),
66
+					'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
67
+				],
68
+				$this
69
+			)
70
+		);
71
+		$this->addLocalizedVars(
72
+			[
73
+				'ee_gmap' => EEH_Maps::$gmap_vars,
74
+			],
75
+			'ee_gmap_vars'
76
+		);
77
+	}
78 78
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorSimple.php 2 patches
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.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -19,59 +19,59 @@
 block discarded – undo
19 19
  */
20 20
 class TicketSelectorSimple extends TicketSelector
21 21
 {
22
-    /**
23
-     * @var EE_Ticket $ticket
24
-     */
25
-    protected $ticket;
22
+	/**
23
+	 * @var EE_Ticket $ticket
24
+	 */
25
+	protected $ticket;
26 26
 
27 27
 
28
-    /**
29
-     * TicketSelectorSimple constructor.
30
-     *
31
-     * @param EE_Event  $event
32
-     * @param EE_Ticket $ticket
33
-     * @param int       $max_attendees
34
-     * @param array     $template_args
35
-     * @throws EE_Error
36
-     */
37
-    public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args)
38
-    {
39
-        $this->ticket = $ticket;
40
-        parent::__construct(
41
-            $event,
42
-            [$this->ticket],
43
-            $max_attendees,
44
-            $template_args
45
-        );
46
-    }
28
+	/**
29
+	 * TicketSelectorSimple constructor.
30
+	 *
31
+	 * @param EE_Event  $event
32
+	 * @param EE_Ticket $ticket
33
+	 * @param int       $max_attendees
34
+	 * @param array     $template_args
35
+	 * @throws EE_Error
36
+	 */
37
+	public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args)
38
+	{
39
+		$this->ticket = $ticket;
40
+		parent::__construct(
41
+			$event,
42
+			[$this->ticket],
43
+			$max_attendees,
44
+			$template_args
45
+		);
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * sets any and all template args that are required for this Ticket Selector
51
-     *
52
-     * @return void
53
-     * @throws UnexpectedEntityException
54
-     * @throws EE_Error
55
-     */
56
-    protected function addTemplateArgs()
57
-    {
58
-        $this->ticket_rows = 1;
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
-    }
49
+	/**
50
+	 * sets any and all template args that are required for this Ticket Selector
51
+	 *
52
+	 * @return void
53
+	 * @throws UnexpectedEntityException
54
+	 * @throws EE_Error
55
+	 */
56
+	protected function addTemplateArgs()
57
+	{
58
+		$this->ticket_rows = 1;
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.
modules/feeds/EED_Feeds.module.php 2 patches
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.
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -11,218 +11,218 @@
 block discarded – undo
11 11
  */
12 12
 class EED_Feeds extends EED_Module
13 13
 {
14
-    /**
15
-     * @return EED_Feeds
16
-     */
17
-    public static function instance()
18
-    {
19
-        return parent::get_instance(__CLASS__);
20
-    }
21
-
22
-
23
-    /**
24
-     *    set_hooks - for hooking into EE Core, other modules, etc
25
-     *
26
-     * @access    public
27
-     * @return    void
28
-     */
29
-    public static function set_hooks()
30
-    {
31
-        add_action('parse_request', array('EED_Feeds', 'parse_request'), 10);
32
-        add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1);
33
-        add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2);
34
-        add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2);
35
-    }
36
-
37
-    /**
38
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
-     *
40
-     * @access    public
41
-     * @return    void
42
-     */
43
-    public static function set_hooks_admin()
44
-    {
45
-    }
46
-
47
-
48
-    /**
49
-     *    run - initial module setup
50
-     *
51
-     * @access    public
52
-     * @return    void
53
-     */
54
-    public function run($WP)
55
-    {
56
-    }
57
-
58
-
59
-    /**
60
-     *    default_feed
61
-     *
62
-     * @access    public
63
-     * @param    type    rss2, atom, rss, rdf, rssjs
64
-     * @return    string
65
-     */
66
-    public static function default_feed($type = 'rss2')
67
-    {
68
-        // rss2, atom, rss, rdf, rssjs
69
-        $type = 'rss2';
70
-        return $type;
71
-    }
72
-
73
-
74
-    /**
75
-     *    parse_request
76
-     *
77
-     * @access    public
78
-     * @return    void
79
-     */
80
-    public static function parse_request()
81
-    {
82
-        $request = self::getRequest();
83
-        if ($request->requestParamIsSet('post_type')) {
84
-            // define path to templates
85
-            define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
86
-            // what kinda post_type are we dealing with ?
87
-            switch ($request->getRequestParam('post_type')) {
88
-                case 'espresso_events':
89
-                    // for rss2, atom, rss, rdf
90
-                    add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1);
91
-                    add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1);
92
-                    // for json ( also uses the above filter )
93
-                    add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1);
94
-                    break;
95
-                case 'espresso_venues':
96
-                    // for rss2, atom, rss, rdf
97
-                    add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1);
98
-                    add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1);
99
-                    // for json ( also uses the above filter )
100
-                    add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1);
101
-                    break;
102
-            }
103
-        }
104
-    }
105
-
106
-
107
-    /**
108
-     *    comment_feed_join - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
109
-     *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
110
-     *    so this little snippet of SQL taps into the comment feed query and removes comments for the
111
-     *    espresso_attendees post_type
112
-     *
113
-     * @access    public
114
-     * @param    string $SQL the JOIN clause for the comment feed query
115
-     * @return    void
116
-     */
117
-    public static function comment_feed_join($SQL)
118
-    {
119
-        global $wpdb;
120
-        // check for wp_posts table in JOIN clause
121
-        if (strpos($SQL, $wpdb->posts) !== false) {
122
-            add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true');
123
-        }
124
-        return $SQL;
125
-    }
126
-
127
-
128
-    /**
129
-     *    comment_feed_where - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
130
-     *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
131
-     *    so this little snippet of SQL taps into the comment feed query and removes comments for the
132
-     *    espresso_attendees post_type
133
-     *
134
-     * @access    public
135
-     * @param    string $SQL the WHERE clause for the comment feed query
136
-     * @return    void
137
-     */
138
-    public static function comment_feed_where($SQL)
139
-    {
140
-        global $wp_query, $wpdb;
141
-        if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', false)) {
142
-            $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'";
143
-        }
144
-        return $SQL;
145
-    }
146
-
147
-
148
-    /**
149
-     *    the_event_feed
150
-     *
151
-     * @access    public
152
-     * @param    string $content
153
-     * @return    void
154
-     */
155
-    public static function the_event_feed($content)
156
-    {
157
-        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php')) {
158
-            global $post;
159
-            $template_args = array(
160
-                'EVT_ID'            => $post->ID,
161
-                'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
162
-            );
163
-            $content = EEH_Template::display_template(
164
-                RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php',
165
-                $template_args,
166
-                true
167
-            );
168
-        }
169
-        return $content;
170
-    }
171
-
172
-
173
-    /**
174
-     *    the_event_rssjs_feed
175
-     *
176
-     * @access    public
177
-     * @param    object $item
178
-     * @return    void
179
-     */
180
-    public static function the_event_rssjs_feed($item)
181
-    {
182
-        if (is_feed() && isset($item->description)) {
183
-            $item->description = EED_Feeds::the_event_feed($item->description);
184
-        }
185
-        return $item;
186
-    }
187
-
188
-
189
-    /**
190
-     *    the_venue_feed
191
-     *
192
-     * @access    public
193
-     * @param    string $content
194
-     * @return    void
195
-     */
196
-    public static function the_venue_feed($content)
197
-    {
198
-        if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php')) {
199
-            global $post;
200
-            $template_args = array(
201
-                'VNU_ID'            => $post->ID,
202
-                'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
203
-            );
204
-            $content = EEH_Template::display_template(
205
-                RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php',
206
-                $template_args,
207
-                true
208
-            );
209
-        }
210
-        return $content;
211
-    }
212
-
213
-
214
-    /**
215
-     *    the_venue_rssjs_feed
216
-     *
217
-     * @access    public
218
-     * @param    object $item
219
-     * @return    void
220
-     */
221
-    public static function the_venue_rssjs_feed($item)
222
-    {
223
-        if (is_feed() && isset($item->description)) {
224
-            $item->description = EED_Feeds::the_venue_feed($item->description);
225
-        }
226
-        return $item;
227
-    }
14
+	/**
15
+	 * @return EED_Feeds
16
+	 */
17
+	public static function instance()
18
+	{
19
+		return parent::get_instance(__CLASS__);
20
+	}
21
+
22
+
23
+	/**
24
+	 *    set_hooks - for hooking into EE Core, other modules, etc
25
+	 *
26
+	 * @access    public
27
+	 * @return    void
28
+	 */
29
+	public static function set_hooks()
30
+	{
31
+		add_action('parse_request', array('EED_Feeds', 'parse_request'), 10);
32
+		add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1);
33
+		add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2);
34
+		add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2);
35
+	}
36
+
37
+	/**
38
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
+	 *
40
+	 * @access    public
41
+	 * @return    void
42
+	 */
43
+	public static function set_hooks_admin()
44
+	{
45
+	}
46
+
47
+
48
+	/**
49
+	 *    run - initial module setup
50
+	 *
51
+	 * @access    public
52
+	 * @return    void
53
+	 */
54
+	public function run($WP)
55
+	{
56
+	}
57
+
58
+
59
+	/**
60
+	 *    default_feed
61
+	 *
62
+	 * @access    public
63
+	 * @param    type    rss2, atom, rss, rdf, rssjs
64
+	 * @return    string
65
+	 */
66
+	public static function default_feed($type = 'rss2')
67
+	{
68
+		// rss2, atom, rss, rdf, rssjs
69
+		$type = 'rss2';
70
+		return $type;
71
+	}
72
+
73
+
74
+	/**
75
+	 *    parse_request
76
+	 *
77
+	 * @access    public
78
+	 * @return    void
79
+	 */
80
+	public static function parse_request()
81
+	{
82
+		$request = self::getRequest();
83
+		if ($request->requestParamIsSet('post_type')) {
84
+			// define path to templates
85
+			define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/');
86
+			// what kinda post_type are we dealing with ?
87
+			switch ($request->getRequestParam('post_type')) {
88
+				case 'espresso_events':
89
+					// for rss2, atom, rss, rdf
90
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1);
91
+					add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1);
92
+					// for json ( also uses the above filter )
93
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1);
94
+					break;
95
+				case 'espresso_venues':
96
+					// for rss2, atom, rss, rdf
97
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1);
98
+					add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1);
99
+					// for json ( also uses the above filter )
100
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1);
101
+					break;
102
+			}
103
+		}
104
+	}
105
+
106
+
107
+	/**
108
+	 *    comment_feed_join - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
109
+	 *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
110
+	 *    so this little snippet of SQL taps into the comment feed query and removes comments for the
111
+	 *    espresso_attendees post_type
112
+	 *
113
+	 * @access    public
114
+	 * @param    string $SQL the JOIN clause for the comment feed query
115
+	 * @return    void
116
+	 */
117
+	public static function comment_feed_join($SQL)
118
+	{
119
+		global $wpdb;
120
+		// check for wp_posts table in JOIN clause
121
+		if (strpos($SQL, $wpdb->posts) !== false) {
122
+			add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true');
123
+		}
124
+		return $SQL;
125
+	}
126
+
127
+
128
+	/**
129
+	 *    comment_feed_where - EVEN THOUGH... our espresso_attendees custom post type is set to NOT PUBLIC
130
+	 *    WordPress thought it would be a good idea to display the comments for them in the RSS feeds... we think NOT
131
+	 *    so this little snippet of SQL taps into the comment feed query and removes comments for the
132
+	 *    espresso_attendees post_type
133
+	 *
134
+	 * @access    public
135
+	 * @param    string $SQL the WHERE clause for the comment feed query
136
+	 * @return    void
137
+	 */
138
+	public static function comment_feed_where($SQL)
139
+	{
140
+		global $wp_query, $wpdb;
141
+		if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', false)) {
142
+			$SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'";
143
+		}
144
+		return $SQL;
145
+	}
146
+
147
+
148
+	/**
149
+	 *    the_event_feed
150
+	 *
151
+	 * @access    public
152
+	 * @param    string $content
153
+	 * @return    void
154
+	 */
155
+	public static function the_event_feed($content)
156
+	{
157
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php')) {
158
+			global $post;
159
+			$template_args = array(
160
+				'EVT_ID'            => $post->ID,
161
+				'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
162
+			);
163
+			$content = EEH_Template::display_template(
164
+				RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php',
165
+				$template_args,
166
+				true
167
+			);
168
+		}
169
+		return $content;
170
+	}
171
+
172
+
173
+	/**
174
+	 *    the_event_rssjs_feed
175
+	 *
176
+	 * @access    public
177
+	 * @param    object $item
178
+	 * @return    void
179
+	 */
180
+	public static function the_event_rssjs_feed($item)
181
+	{
182
+		if (is_feed() && isset($item->description)) {
183
+			$item->description = EED_Feeds::the_event_feed($item->description);
184
+		}
185
+		return $item;
186
+	}
187
+
188
+
189
+	/**
190
+	 *    the_venue_feed
191
+	 *
192
+	 * @access    public
193
+	 * @param    string $content
194
+	 * @return    void
195
+	 */
196
+	public static function the_venue_feed($content)
197
+	{
198
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php')) {
199
+			global $post;
200
+			$template_args = array(
201
+				'VNU_ID'            => $post->ID,
202
+				'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content,
203
+			);
204
+			$content = EEH_Template::display_template(
205
+				RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php',
206
+				$template_args,
207
+				true
208
+			);
209
+		}
210
+		return $content;
211
+	}
212
+
213
+
214
+	/**
215
+	 *    the_venue_rssjs_feed
216
+	 *
217
+	 * @access    public
218
+	 * @param    object $item
219
+	 * @return    void
220
+	 */
221
+	public static function the_venue_rssjs_feed($item)
222
+	{
223
+		if (is_feed() && isset($item->description)) {
224
+			$item->description = EED_Feeds::the_venue_feed($item->description);
225
+		}
226
+		return $item;
227
+	}
228 228
 }
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   +653 added lines, -653 removed lines patch added patch discarded remove patch
@@ -13,657 +13,657 @@
 block discarded – undo
13 13
  */
14 14
 abstract class EE_SPCO_Reg_Step
15 15
 {
16
-    /**
17
-     *    $_completed - TRUE if this step has fully completed it's duties
18
-     *
19
-     * @access protected
20
-     * @type bool $_completed
21
-     */
22
-    protected $_completed = false;
23
-
24
-    /**
25
-     *    $_is_current_step - TRUE if this is the current step
26
-     *
27
-     * @access protected
28
-     * @type bool $_is_current_step
29
-     */
30
-    protected $_is_current_step = false;
31
-
32
-    /**
33
-     *    $_order - when the reg step should be run relative to other steps
34
-     *
35
-     * @access protected
36
-     * @type int $_template
37
-     */
38
-    protected $_order = 0;
39
-
40
-    /**
41
-     *    $_slug - URL param for this step
42
-     *
43
-     * @access protected
44
-     * @type string $_slug
45
-     */
46
-    protected $_slug;
47
-
48
-    /**
49
-     *    $_name - Step Name - translatable string
50
-     *
51
-     * @access protected
52
-     * @type string $_slug
53
-     */
54
-    protected $_name;
55
-
56
-    /**
57
-     *    $_submit_button_text - translatable string that appears on this step's submit button
58
-     *
59
-     * @access protected
60
-     * @type string $_slug
61
-     */
62
-    protected $_submit_button_text;
63
-
64
-    /**
65
-     *    $_template - template name
66
-     *
67
-     * @access protected
68
-     * @type string $_template
69
-     */
70
-    protected $_template;
71
-
72
-    /**
73
-     *    $_reg_form_name - the form input name and id attribute
74
-     *
75
-     * @access protected
76
-     * @var string $_reg_form_name
77
-     */
78
-    protected $_reg_form_name;
79
-
80
-    /**
81
-     *    $_success_message - text to display upon successful form submission
82
-     *
83
-     * @access private
84
-     * @var string $_success_message
85
-     */
86
-    protected $_success_message;
87
-
88
-    /**
89
-     *    $_instructions - a brief description of how to complete the reg step.
90
-     *    Usually displayed in conjunction with the previous step's success message.
91
-     *
92
-     * @access private
93
-     * @var string $_instructions
94
-     */
95
-    protected $_instructions;
96
-
97
-    /**
98
-     *    $_valid_data - the normalized and validated data for this step
99
-     *
100
-     * @access public
101
-     * @var array $_valid_data
102
-     */
103
-    protected $_valid_data = [];
104
-
105
-    /**
106
-     *    $reg_form - the registration form for this step
107
-     *
108
-     * @access public
109
-     * @var EE_Form_Section_Proper $reg_form
110
-     */
111
-    public $reg_form;
112
-
113
-    /**
114
-     *    $checkout - EE_Checkout object for handling the properties of the current checkout process
115
-     *
116
-     * @access public
117
-     * @var EE_Checkout $checkout
118
-     */
119
-    public $checkout;
120
-
121
-    /**
122
-     * @var RequestInterface $request
123
-     */
124
-    protected $request;
125
-
126
-
127
-    /**
128
-     * @return void
129
-     */
130
-    abstract public function translate_js_strings();
131
-
132
-
133
-    /**
134
-     * @return void
135
-     */
136
-    abstract public function enqueue_styles_and_scripts();
137
-
138
-
139
-    /**
140
-     * @return boolean
141
-     */
142
-    abstract public function initialize_reg_step();
143
-
144
-
145
-    /**
146
-     * @return EE_Form_Section_Proper
147
-     */
148
-    abstract public function generate_reg_form();
149
-
150
-
151
-    /**
152
-     * @return boolean
153
-     */
154
-    abstract public function process_reg_step();
155
-
156
-
157
-    /**
158
-     * @return boolean
159
-     */
160
-    abstract public function update_reg_step();
161
-
162
-
163
-    /**
164
-     * @return boolean
165
-     */
166
-    public function completed()
167
-    {
168
-        return $this->_completed;
169
-    }
170
-
171
-
172
-    /**
173
-     * set_completed - toggles $_completed to TRUE
174
-     */
175
-    public function set_completed()
176
-    {
177
-        // DEBUG LOG
178
-        // $this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
179
-        $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this);
180
-    }
181
-
182
-
183
-    /**
184
-     * set_completed - toggles $_completed to FALSE
185
-     */
186
-    public function set_not_completed()
187
-    {
188
-        $this->_completed = false;
189
-    }
190
-
191
-
192
-    /**
193
-     * @return string
194
-     */
195
-    public function name()
196
-    {
197
-        return $this->_name;
198
-    }
199
-
200
-
201
-    /**
202
-     * @return string
203
-     */
204
-    public function slug()
205
-    {
206
-        return $this->_slug;
207
-    }
208
-
209
-
210
-    /**
211
-     * submit_button_text
212
-     * the text that appears on the reg step form submit button
213
-     *
214
-     * @return string
215
-     */
216
-    public function submit_button_text()
217
-    {
218
-        return $this->_submit_button_text;
219
-    }
220
-
221
-
222
-    /**
223
-     * set_submit_button_text
224
-     * sets the text that appears on the reg step form submit button
225
-     *
226
-     * @param string $submit_button_text
227
-     */
228
-    public function set_submit_button_text($submit_button_text = '')
229
-    {
230
-        if (! empty($submit_button_text)) {
231
-            $this->_submit_button_text = $submit_button_text;
232
-        } elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
233
-            if ($this->checkout->revisit) {
234
-                $this->_submit_button_text = sprintf(
235
-                    esc_html__('Update %s', 'event_espresso'),
236
-                    $this->checkout->current_step->name()
237
-                );
238
-            } else {
239
-                $this->_submit_button_text = sprintf(
240
-                    esc_html__('Proceed to %s', 'event_espresso'),
241
-                    $this->checkout->next_step->name()
242
-                );
243
-            }
244
-        }
245
-        // filters the submit button text
246
-        $this->_submit_button_text = apply_filters(
247
-            'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
248
-            $this->_submit_button_text,
249
-            $this->checkout
250
-        );
251
-    }
252
-
253
-
254
-    /**
255
-     * @param boolean $is_current_step
256
-     */
257
-    public function set_is_current_step($is_current_step)
258
-    {
259
-        $this->_is_current_step = $is_current_step;
260
-    }
261
-
262
-
263
-    /**
264
-     * @return boolean
265
-     */
266
-    public function is_current_step()
267
-    {
268
-        return $this->_is_current_step;
269
-    }
270
-
271
-
272
-    /**
273
-     * @return boolean
274
-     */
275
-    public function is_final_step()
276
-    {
277
-        return $this instanceof EE_SPCO_Reg_Step_Finalize_Registration;
278
-    }
279
-
280
-
281
-    /**
282
-     * @param int $order
283
-     */
284
-    public function set_order($order)
285
-    {
286
-        $this->_order = $order;
287
-    }
288
-
289
-
290
-    /**
291
-     * @return int
292
-     */
293
-    public function order()
294
-    {
295
-        return $this->_order;
296
-    }
297
-
298
-
299
-    /**
300
-     * @return string
301
-     */
302
-    public function template(): string
303
-    {
304
-        return $this->_template;
305
-    }
306
-
307
-
308
-    /**
309
-     * @param string $template
310
-     */
311
-    public function setTemplate(string $template): void
312
-    {
313
-        $this->_template = $template;
314
-    }
315
-
316
-
317
-    /**
318
-     * @return string
319
-     */
320
-    public function success_message()
321
-    {
322
-        return $this->_success_message;
323
-    }
324
-
325
-
326
-    /**
327
-     * _set_success_message
328
-     *
329
-     * @param string $success_message
330
-     */
331
-    protected function _set_success_message($success_message)
332
-    {
333
-        $this->_success_message = $success_message;
334
-    }
335
-
336
-
337
-    /**
338
-     * _reset_success_message
339
-     *
340
-     * @return void
341
-     */
342
-    protected function _reset_success_message()
343
-    {
344
-        $this->_success_message = '';
345
-    }
346
-
347
-
348
-    /**
349
-     * @return string
350
-     */
351
-    public function _instructions()
352
-    {
353
-        return $this->_instructions;
354
-    }
355
-
356
-
357
-    /**
358
-     * @param string $instructions
359
-     */
360
-    public function set_instructions($instructions)
361
-    {
362
-        $this->_instructions = apply_filters(
363
-            'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions',
364
-            $instructions,
365
-            $this
366
-        );
367
-    }
368
-
369
-
370
-    /**
371
-     * @param array $valid_data
372
-     */
373
-    public function set_valid_data($valid_data)
374
-    {
375
-        $this->_valid_data = $valid_data;
376
-    }
377
-
378
-
379
-    /**
380
-     * @return array
381
-     * @throws EE_Error
382
-     * @throws EE_Error
383
-     */
384
-    public function valid_data()
385
-    {
386
-        if (empty($this->_valid_data)) {
387
-            $this->_valid_data = $this->reg_form->valid_data();
388
-        }
389
-        return $this->_valid_data;
390
-    }
391
-
392
-
393
-    /**
394
-     * @return string
395
-     */
396
-    public function reg_form_name()
397
-    {
398
-        if (empty($this->_reg_form_name)) {
399
-            $this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form');
400
-        }
401
-        return $this->_reg_form_name;
402
-    }
403
-
404
-
405
-    /**
406
-     * @param string $reg_form_name
407
-     */
408
-    protected function set_reg_form_name($reg_form_name)
409
-    {
410
-        $this->_reg_form_name = $reg_form_name;
411
-    }
412
-
413
-
414
-    /**
415
-     * reg_step_url
416
-     *
417
-     * @param string $action
418
-     * @return string
419
-     */
420
-    public function reg_step_url($action = '')
421
-    {
422
-        $query_args = ['step' => $this->slug()];
423
-        if (! empty($action)) {
424
-            $query_args['action'] = $action;
425
-        }
426
-        // final step has no display
427
-        if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') {
428
-            $query_args['action'] = 'process_reg_step';
429
-        }
430
-        if ($this->checkout->revisit) {
431
-            $query_args['revisit'] = true;
432
-        }
433
-        if ($this->checkout->reg_url_link) {
434
-            $query_args['e_reg_url_link'] = $this->checkout->reg_url_link;
435
-        }
436
-        return add_query_arg($query_args, $this->checkout->reg_page_base_url);
437
-    }
438
-
439
-
440
-    /**
441
-     * creates the default hidden inputs section
442
-     *
443
-     * @return EE_Form_Section_Proper
444
-     * @throws EE_Error
445
-     */
446
-    public function reg_step_hidden_inputs()
447
-    {
448
-        // hidden inputs for admin registrations
449
-        if ($this->checkout->admin_request) {
450
-            return new EE_Form_Section_Proper(
451
-                [
452
-                    'layout_strategy' => new EE_Div_Per_Section_Layout(),
453
-                    'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
454
-                    'subsections'     => [
455
-                        'next_step' => new EE_Fixed_Hidden_Input(
456
-                            [
457
-                                'html_name' => 'next_step',
458
-                                'html_id'   => 'spco-' . $this->slug() . '-next-step',
459
-                                'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
460
-                                    ? $this->checkout->next_step->slug()
461
-                                    : '',
462
-                            ]
463
-                        ),
464
-                    ],
465
-                ]
466
-            );
467
-        }
468
-        // hidden inputs for frontend registrations
469
-        return new EE_Form_Section_Proper(
470
-            [
471
-                'layout_strategy' => new EE_Div_Per_Section_Layout(),
472
-                'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
473
-                'subsections'     => [
474
-                    'action'         => new EE_Fixed_Hidden_Input(
475
-                        [
476
-                            'html_name' => 'action',
477
-                            'html_id'   => 'spco-' . $this->slug() . '-action',
478
-                            'default'   => apply_filters(
479
-                                'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',
480
-                                empty($this->checkout->reg_url_link)
481
-                                    ? 'process_reg_step'
482
-                                    : 'update_reg_step',
483
-                                $this
484
-                            ),
485
-                        ]
486
-                    ),
487
-                    'next_step'      => new EE_Fixed_Hidden_Input(
488
-                        [
489
-                            'html_name' => 'next_step',
490
-                            'html_id'   => 'spco-' . $this->slug() . '-next-step',
491
-                            'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
492
-                                ? $this->checkout->next_step->slug()
493
-                                : '',
494
-                        ]
495
-                    ),
496
-                    'e_reg_url_link' => new EE_Fixed_Hidden_Input(
497
-                        [
498
-                            'html_name' => 'e_reg_url_link',
499
-                            'html_id'   => 'spco-reg_url_link',
500
-                            'default'   => $this->checkout->reg_url_link,
501
-                        ]
502
-                    ),
503
-                    'revisit'        => new EE_Fixed_Hidden_Input(
504
-                        [
505
-                            'html_name' => 'revisit',
506
-                            'html_id'   => 'spco-revisit',
507
-                            'default'   => $this->checkout->revisit,
508
-                        ]
509
-                    ),
510
-                ],
511
-            ]
512
-        );
513
-    }
514
-
515
-
516
-    /**
517
-     * generate_reg_form_for_actions
518
-     *
519
-     * @param array $actions
520
-     * @return void
521
-     */
522
-    public function generate_reg_form_for_actions($actions = [])
523
-    {
524
-        $actions                           = array_merge(
525
-            [
526
-                'generate_reg_form',
527
-                'display_spco_reg_step',
528
-                'process_reg_step',
529
-                'update_reg_step',
530
-            ],
531
-            $actions
532
-        );
533
-        $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions, true);
534
-    }
535
-
536
-
537
-    /**
538
-     * @return string
539
-     * @throws EE_Error
540
-     */
541
-    public function display_reg_form()
542
-    {
543
-        $html = '';
544
-        if ($this->reg_form instanceof EE_Form_Section_Proper) {
545
-            do_action('AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', $this->reg_form, $this);
546
-            $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';
547
-            if ($this->request->isAjax()) {
548
-                $this->reg_form->localize_validation_rules();
549
-                $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
550
-            }
551
-            $html .= $this->reg_form->get_html();
552
-            $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : '';
553
-            $html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : '';
554
-        }
555
-        return $html;
556
-    }
557
-
558
-
559
-    /**
560
-     * div_class - returns nothing for current step, but a css class of "hidden" for others
561
-     *
562
-     * @return string
563
-     * @throws EE_Error
564
-     */
565
-    public function reg_step_submit_button()
566
-    {
567
-        if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
568
-            return '';
569
-        }
570
-        ob_start();
571
-        do_action(
572
-            'AHEE__before_spco_whats_next_buttons',
573
-            $this->slug(),
574
-            $this->checkout->next_step->slug(),
575
-            $this->checkout
576
-        );
577
-        $html = ob_get_clean();
578
-        // generate submit button
579
-        $submit_btn = new EE_Submit_Input(
580
-            [
581
-                'html_name'             => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
582
-                'html_id'               => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
583
-                'html_class'            => 'spco-next-step-btn',
584
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
585
-                'default'               => $this->submit_button_text(),
586
-            ]
587
-        );
588
-        $submit_btn->set_button_css_attributes(true, 'large');
589
-        $submit_btn_html = $submit_btn->get_html_for_input();
590
-        $html            .= EEH_HTML::div(
591
-            apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $submit_btn_html, $this),
592
-            'spco-' . $this->slug() . '-whats-next-buttons-dv',
593
-            'spco-whats-next-buttons'
594
-        );
595
-        return $html;
596
-    }
597
-
598
-
599
-    /**
600
-     * div_class - returns nothing for current step, but a css class of "hidden" for others
601
-     *
602
-     * @return string
603
-     */
604
-    public function div_class()
605
-    {
606
-        return $this->is_current_step() ? '' : ' hidden';
607
-    }
608
-
609
-
610
-    /**
611
-     * div_class - returns  a css class of "hidden" for current step, but nothing for others
612
-     *
613
-     * @return string
614
-     */
615
-    public function edit_lnk_url()
616
-    {
617
-        return add_query_arg(['step' => $this->slug()], $this->checkout->reg_page_base_url);
618
-    }
619
-
620
-
621
-    /**
622
-     * div_class - returns  a css class of "hidden" for current step, but nothing for others
623
-     *
624
-     * @return string
625
-     */
626
-    public function edit_link_class()
627
-    {
628
-        return $this->is_current_step() ? ' hidden' : '';
629
-    }
630
-
631
-
632
-    /**
633
-     * update_checkout with changes that have been made to the cart
634
-     *
635
-     * @return void
636
-     * @throws EE_Error
637
-     * @throws ReflectionException
638
-     */
639
-    public function update_checkout()
640
-    {
641
-        // grab the cart grand total and reset TXN total
642
-        $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());
643
-        $this->checkout->stash_transaction_and_checkout();
644
-    }
645
-
646
-
647
-    /**
648
-     *    __sleep
649
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon
650
-     * serialization EE_Checkout will handle the reimplementation of itself upon waking, but we won't bother with the
651
-     * reg form, because if needed, it will be regenerated anyways
652
-     *
653
-     * @return array
654
-     */
655
-    public function __sleep()
656
-    {
657
-        // remove the reg form and the checkout
658
-        return array_diff(array_keys(get_object_vars($this)), ['reg_form', 'checkout']);
659
-    }
660
-
661
-
662
-    /**
663
-     * @param RequestInterface $request
664
-     */
665
-    public function setRequest(RequestInterface $request)
666
-    {
667
-        $this->request = $request;
668
-    }
16
+	/**
17
+	 *    $_completed - TRUE if this step has fully completed it's duties
18
+	 *
19
+	 * @access protected
20
+	 * @type bool $_completed
21
+	 */
22
+	protected $_completed = false;
23
+
24
+	/**
25
+	 *    $_is_current_step - TRUE if this is the current step
26
+	 *
27
+	 * @access protected
28
+	 * @type bool $_is_current_step
29
+	 */
30
+	protected $_is_current_step = false;
31
+
32
+	/**
33
+	 *    $_order - when the reg step should be run relative to other steps
34
+	 *
35
+	 * @access protected
36
+	 * @type int $_template
37
+	 */
38
+	protected $_order = 0;
39
+
40
+	/**
41
+	 *    $_slug - URL param for this step
42
+	 *
43
+	 * @access protected
44
+	 * @type string $_slug
45
+	 */
46
+	protected $_slug;
47
+
48
+	/**
49
+	 *    $_name - Step Name - translatable string
50
+	 *
51
+	 * @access protected
52
+	 * @type string $_slug
53
+	 */
54
+	protected $_name;
55
+
56
+	/**
57
+	 *    $_submit_button_text - translatable string that appears on this step's submit button
58
+	 *
59
+	 * @access protected
60
+	 * @type string $_slug
61
+	 */
62
+	protected $_submit_button_text;
63
+
64
+	/**
65
+	 *    $_template - template name
66
+	 *
67
+	 * @access protected
68
+	 * @type string $_template
69
+	 */
70
+	protected $_template;
71
+
72
+	/**
73
+	 *    $_reg_form_name - the form input name and id attribute
74
+	 *
75
+	 * @access protected
76
+	 * @var string $_reg_form_name
77
+	 */
78
+	protected $_reg_form_name;
79
+
80
+	/**
81
+	 *    $_success_message - text to display upon successful form submission
82
+	 *
83
+	 * @access private
84
+	 * @var string $_success_message
85
+	 */
86
+	protected $_success_message;
87
+
88
+	/**
89
+	 *    $_instructions - a brief description of how to complete the reg step.
90
+	 *    Usually displayed in conjunction with the previous step's success message.
91
+	 *
92
+	 * @access private
93
+	 * @var string $_instructions
94
+	 */
95
+	protected $_instructions;
96
+
97
+	/**
98
+	 *    $_valid_data - the normalized and validated data for this step
99
+	 *
100
+	 * @access public
101
+	 * @var array $_valid_data
102
+	 */
103
+	protected $_valid_data = [];
104
+
105
+	/**
106
+	 *    $reg_form - the registration form for this step
107
+	 *
108
+	 * @access public
109
+	 * @var EE_Form_Section_Proper $reg_form
110
+	 */
111
+	public $reg_form;
112
+
113
+	/**
114
+	 *    $checkout - EE_Checkout object for handling the properties of the current checkout process
115
+	 *
116
+	 * @access public
117
+	 * @var EE_Checkout $checkout
118
+	 */
119
+	public $checkout;
120
+
121
+	/**
122
+	 * @var RequestInterface $request
123
+	 */
124
+	protected $request;
125
+
126
+
127
+	/**
128
+	 * @return void
129
+	 */
130
+	abstract public function translate_js_strings();
131
+
132
+
133
+	/**
134
+	 * @return void
135
+	 */
136
+	abstract public function enqueue_styles_and_scripts();
137
+
138
+
139
+	/**
140
+	 * @return boolean
141
+	 */
142
+	abstract public function initialize_reg_step();
143
+
144
+
145
+	/**
146
+	 * @return EE_Form_Section_Proper
147
+	 */
148
+	abstract public function generate_reg_form();
149
+
150
+
151
+	/**
152
+	 * @return boolean
153
+	 */
154
+	abstract public function process_reg_step();
155
+
156
+
157
+	/**
158
+	 * @return boolean
159
+	 */
160
+	abstract public function update_reg_step();
161
+
162
+
163
+	/**
164
+	 * @return boolean
165
+	 */
166
+	public function completed()
167
+	{
168
+		return $this->_completed;
169
+	}
170
+
171
+
172
+	/**
173
+	 * set_completed - toggles $_completed to TRUE
174
+	 */
175
+	public function set_completed()
176
+	{
177
+		// DEBUG LOG
178
+		// $this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
179
+		$this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this);
180
+	}
181
+
182
+
183
+	/**
184
+	 * set_completed - toggles $_completed to FALSE
185
+	 */
186
+	public function set_not_completed()
187
+	{
188
+		$this->_completed = false;
189
+	}
190
+
191
+
192
+	/**
193
+	 * @return string
194
+	 */
195
+	public function name()
196
+	{
197
+		return $this->_name;
198
+	}
199
+
200
+
201
+	/**
202
+	 * @return string
203
+	 */
204
+	public function slug()
205
+	{
206
+		return $this->_slug;
207
+	}
208
+
209
+
210
+	/**
211
+	 * submit_button_text
212
+	 * the text that appears on the reg step form submit button
213
+	 *
214
+	 * @return string
215
+	 */
216
+	public function submit_button_text()
217
+	{
218
+		return $this->_submit_button_text;
219
+	}
220
+
221
+
222
+	/**
223
+	 * set_submit_button_text
224
+	 * sets the text that appears on the reg step form submit button
225
+	 *
226
+	 * @param string $submit_button_text
227
+	 */
228
+	public function set_submit_button_text($submit_button_text = '')
229
+	{
230
+		if (! empty($submit_button_text)) {
231
+			$this->_submit_button_text = $submit_button_text;
232
+		} elseif ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
233
+			if ($this->checkout->revisit) {
234
+				$this->_submit_button_text = sprintf(
235
+					esc_html__('Update %s', 'event_espresso'),
236
+					$this->checkout->current_step->name()
237
+				);
238
+			} else {
239
+				$this->_submit_button_text = sprintf(
240
+					esc_html__('Proceed to %s', 'event_espresso'),
241
+					$this->checkout->next_step->name()
242
+				);
243
+			}
244
+		}
245
+		// filters the submit button text
246
+		$this->_submit_button_text = apply_filters(
247
+			'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
248
+			$this->_submit_button_text,
249
+			$this->checkout
250
+		);
251
+	}
252
+
253
+
254
+	/**
255
+	 * @param boolean $is_current_step
256
+	 */
257
+	public function set_is_current_step($is_current_step)
258
+	{
259
+		$this->_is_current_step = $is_current_step;
260
+	}
261
+
262
+
263
+	/**
264
+	 * @return boolean
265
+	 */
266
+	public function is_current_step()
267
+	{
268
+		return $this->_is_current_step;
269
+	}
270
+
271
+
272
+	/**
273
+	 * @return boolean
274
+	 */
275
+	public function is_final_step()
276
+	{
277
+		return $this instanceof EE_SPCO_Reg_Step_Finalize_Registration;
278
+	}
279
+
280
+
281
+	/**
282
+	 * @param int $order
283
+	 */
284
+	public function set_order($order)
285
+	{
286
+		$this->_order = $order;
287
+	}
288
+
289
+
290
+	/**
291
+	 * @return int
292
+	 */
293
+	public function order()
294
+	{
295
+		return $this->_order;
296
+	}
297
+
298
+
299
+	/**
300
+	 * @return string
301
+	 */
302
+	public function template(): string
303
+	{
304
+		return $this->_template;
305
+	}
306
+
307
+
308
+	/**
309
+	 * @param string $template
310
+	 */
311
+	public function setTemplate(string $template): void
312
+	{
313
+		$this->_template = $template;
314
+	}
315
+
316
+
317
+	/**
318
+	 * @return string
319
+	 */
320
+	public function success_message()
321
+	{
322
+		return $this->_success_message;
323
+	}
324
+
325
+
326
+	/**
327
+	 * _set_success_message
328
+	 *
329
+	 * @param string $success_message
330
+	 */
331
+	protected function _set_success_message($success_message)
332
+	{
333
+		$this->_success_message = $success_message;
334
+	}
335
+
336
+
337
+	/**
338
+	 * _reset_success_message
339
+	 *
340
+	 * @return void
341
+	 */
342
+	protected function _reset_success_message()
343
+	{
344
+		$this->_success_message = '';
345
+	}
346
+
347
+
348
+	/**
349
+	 * @return string
350
+	 */
351
+	public function _instructions()
352
+	{
353
+		return $this->_instructions;
354
+	}
355
+
356
+
357
+	/**
358
+	 * @param string $instructions
359
+	 */
360
+	public function set_instructions($instructions)
361
+	{
362
+		$this->_instructions = apply_filters(
363
+			'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions',
364
+			$instructions,
365
+			$this
366
+		);
367
+	}
368
+
369
+
370
+	/**
371
+	 * @param array $valid_data
372
+	 */
373
+	public function set_valid_data($valid_data)
374
+	{
375
+		$this->_valid_data = $valid_data;
376
+	}
377
+
378
+
379
+	/**
380
+	 * @return array
381
+	 * @throws EE_Error
382
+	 * @throws EE_Error
383
+	 */
384
+	public function valid_data()
385
+	{
386
+		if (empty($this->_valid_data)) {
387
+			$this->_valid_data = $this->reg_form->valid_data();
388
+		}
389
+		return $this->_valid_data;
390
+	}
391
+
392
+
393
+	/**
394
+	 * @return string
395
+	 */
396
+	public function reg_form_name()
397
+	{
398
+		if (empty($this->_reg_form_name)) {
399
+			$this->set_reg_form_name('ee-spco-' . $this->slug() . '-reg-step-form');
400
+		}
401
+		return $this->_reg_form_name;
402
+	}
403
+
404
+
405
+	/**
406
+	 * @param string $reg_form_name
407
+	 */
408
+	protected function set_reg_form_name($reg_form_name)
409
+	{
410
+		$this->_reg_form_name = $reg_form_name;
411
+	}
412
+
413
+
414
+	/**
415
+	 * reg_step_url
416
+	 *
417
+	 * @param string $action
418
+	 * @return string
419
+	 */
420
+	public function reg_step_url($action = '')
421
+	{
422
+		$query_args = ['step' => $this->slug()];
423
+		if (! empty($action)) {
424
+			$query_args['action'] = $action;
425
+		}
426
+		// final step has no display
427
+		if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') {
428
+			$query_args['action'] = 'process_reg_step';
429
+		}
430
+		if ($this->checkout->revisit) {
431
+			$query_args['revisit'] = true;
432
+		}
433
+		if ($this->checkout->reg_url_link) {
434
+			$query_args['e_reg_url_link'] = $this->checkout->reg_url_link;
435
+		}
436
+		return add_query_arg($query_args, $this->checkout->reg_page_base_url);
437
+	}
438
+
439
+
440
+	/**
441
+	 * creates the default hidden inputs section
442
+	 *
443
+	 * @return EE_Form_Section_Proper
444
+	 * @throws EE_Error
445
+	 */
446
+	public function reg_step_hidden_inputs()
447
+	{
448
+		// hidden inputs for admin registrations
449
+		if ($this->checkout->admin_request) {
450
+			return new EE_Form_Section_Proper(
451
+				[
452
+					'layout_strategy' => new EE_Div_Per_Section_Layout(),
453
+					'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
454
+					'subsections'     => [
455
+						'next_step' => new EE_Fixed_Hidden_Input(
456
+							[
457
+								'html_name' => 'next_step',
458
+								'html_id'   => 'spco-' . $this->slug() . '-next-step',
459
+								'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
460
+									? $this->checkout->next_step->slug()
461
+									: '',
462
+							]
463
+						),
464
+					],
465
+				]
466
+			);
467
+		}
468
+		// hidden inputs for frontend registrations
469
+		return new EE_Form_Section_Proper(
470
+			[
471
+				'layout_strategy' => new EE_Div_Per_Section_Layout(),
472
+				'html_id'         => 'ee-' . $this->slug() . '-hidden-inputs',
473
+				'subsections'     => [
474
+					'action'         => new EE_Fixed_Hidden_Input(
475
+						[
476
+							'html_name' => 'action',
477
+							'html_id'   => 'spco-' . $this->slug() . '-action',
478
+							'default'   => apply_filters(
479
+								'FHEE__EE_SPCO_Reg_Step__reg_step_hidden_inputs__default_form_action',
480
+								empty($this->checkout->reg_url_link)
481
+									? 'process_reg_step'
482
+									: 'update_reg_step',
483
+								$this
484
+							),
485
+						]
486
+					),
487
+					'next_step'      => new EE_Fixed_Hidden_Input(
488
+						[
489
+							'html_name' => 'next_step',
490
+							'html_id'   => 'spco-' . $this->slug() . '-next-step',
491
+							'default'   => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
492
+								? $this->checkout->next_step->slug()
493
+								: '',
494
+						]
495
+					),
496
+					'e_reg_url_link' => new EE_Fixed_Hidden_Input(
497
+						[
498
+							'html_name' => 'e_reg_url_link',
499
+							'html_id'   => 'spco-reg_url_link',
500
+							'default'   => $this->checkout->reg_url_link,
501
+						]
502
+					),
503
+					'revisit'        => new EE_Fixed_Hidden_Input(
504
+						[
505
+							'html_name' => 'revisit',
506
+							'html_id'   => 'spco-revisit',
507
+							'default'   => $this->checkout->revisit,
508
+						]
509
+					),
510
+				],
511
+			]
512
+		);
513
+	}
514
+
515
+
516
+	/**
517
+	 * generate_reg_form_for_actions
518
+	 *
519
+	 * @param array $actions
520
+	 * @return void
521
+	 */
522
+	public function generate_reg_form_for_actions($actions = [])
523
+	{
524
+		$actions                           = array_merge(
525
+			[
526
+				'generate_reg_form',
527
+				'display_spco_reg_step',
528
+				'process_reg_step',
529
+				'update_reg_step',
530
+			],
531
+			$actions
532
+		);
533
+		$this->checkout->generate_reg_form = in_array($this->checkout->action, $actions, true);
534
+	}
535
+
536
+
537
+	/**
538
+	 * @return string
539
+	 * @throws EE_Error
540
+	 */
541
+	public function display_reg_form()
542
+	{
543
+		$html = '';
544
+		if ($this->reg_form instanceof EE_Form_Section_Proper) {
545
+			do_action('AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', $this->reg_form, $this);
546
+			$html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : '';
547
+			if ($this->request->isAjax()) {
548
+				$this->reg_form->localize_validation_rules();
549
+				$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
550
+			}
551
+			$html .= $this->reg_form->get_html();
552
+			$html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : '';
553
+			$html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : '';
554
+		}
555
+		return $html;
556
+	}
557
+
558
+
559
+	/**
560
+	 * div_class - returns nothing for current step, but a css class of "hidden" for others
561
+	 *
562
+	 * @return string
563
+	 * @throws EE_Error
564
+	 */
565
+	public function reg_step_submit_button()
566
+	{
567
+		if (! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
568
+			return '';
569
+		}
570
+		ob_start();
571
+		do_action(
572
+			'AHEE__before_spco_whats_next_buttons',
573
+			$this->slug(),
574
+			$this->checkout->next_step->slug(),
575
+			$this->checkout
576
+		);
577
+		$html = ob_get_clean();
578
+		// generate submit button
579
+		$submit_btn = new EE_Submit_Input(
580
+			[
581
+				'html_name'             => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
582
+				'html_id'               => 'spco-go-to-step-' . $this->checkout->next_step->slug(),
583
+				'html_class'            => 'spco-next-step-btn',
584
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
585
+				'default'               => $this->submit_button_text(),
586
+			]
587
+		);
588
+		$submit_btn->set_button_css_attributes(true, 'large');
589
+		$submit_btn_html = $submit_btn->get_html_for_input();
590
+		$html            .= EEH_HTML::div(
591
+			apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $submit_btn_html, $this),
592
+			'spco-' . $this->slug() . '-whats-next-buttons-dv',
593
+			'spco-whats-next-buttons'
594
+		);
595
+		return $html;
596
+	}
597
+
598
+
599
+	/**
600
+	 * div_class - returns nothing for current step, but a css class of "hidden" for others
601
+	 *
602
+	 * @return string
603
+	 */
604
+	public function div_class()
605
+	{
606
+		return $this->is_current_step() ? '' : ' hidden';
607
+	}
608
+
609
+
610
+	/**
611
+	 * div_class - returns  a css class of "hidden" for current step, but nothing for others
612
+	 *
613
+	 * @return string
614
+	 */
615
+	public function edit_lnk_url()
616
+	{
617
+		return add_query_arg(['step' => $this->slug()], $this->checkout->reg_page_base_url);
618
+	}
619
+
620
+
621
+	/**
622
+	 * div_class - returns  a css class of "hidden" for current step, but nothing for others
623
+	 *
624
+	 * @return string
625
+	 */
626
+	public function edit_link_class()
627
+	{
628
+		return $this->is_current_step() ? ' hidden' : '';
629
+	}
630
+
631
+
632
+	/**
633
+	 * update_checkout with changes that have been made to the cart
634
+	 *
635
+	 * @return void
636
+	 * @throws EE_Error
637
+	 * @throws ReflectionException
638
+	 */
639
+	public function update_checkout()
640
+	{
641
+		// grab the cart grand total and reset TXN total
642
+		$this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total());
643
+		$this->checkout->stash_transaction_and_checkout();
644
+	}
645
+
646
+
647
+	/**
648
+	 *    __sleep
649
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon
650
+	 * serialization EE_Checkout will handle the reimplementation of itself upon waking, but we won't bother with the
651
+	 * reg form, because if needed, it will be regenerated anyways
652
+	 *
653
+	 * @return array
654
+	 */
655
+	public function __sleep()
656
+	{
657
+		// remove the reg form and the checkout
658
+		return array_diff(array_keys(get_object_vars($this)), ['reg_form', 'checkout']);
659
+	}
660
+
661
+
662
+	/**
663
+	 * @param RequestInterface $request
664
+	 */
665
+	public function setRequest(RequestInterface $request)
666
+	{
667
+		$this->request = $request;
668
+	}
669 669
 }
Please login to merge, or discard this patch.
core/services/request/files/FilesDataHandler.php 2 patches
Indentation   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -40,279 +40,279 @@
 block discarded – undo
40 40
  */
41 41
 class FilesDataHandler
42 42
 {
43
-    /**
44
-     * @var Request
45
-     */
46
-    protected $request;
43
+	/**
44
+	 * @var Request
45
+	 */
46
+	protected $request;
47 47
 
48
-    /**
49
-     * @var CollectionInterface | FileSubmissionInterface[]
50
-     */
51
-    protected $file_objects;
48
+	/**
49
+	 * @var CollectionInterface | FileSubmissionInterface[]
50
+	 */
51
+	protected $file_objects;
52 52
 
53
-    /**
54
-     * @var bool
55
-     */
56
-    protected $initialized = false;
53
+	/**
54
+	 * @var bool
55
+	 */
56
+	protected $initialized = false;
57 57
 
58 58
 
59
-    /**
60
-     * FilesDataHandler constructor.
61
-     *
62
-     * @param Request $request
63
-     */
64
-    public function __construct(Request $request)
65
-    {
66
-        $this->request = $request;
67
-    }
59
+	/**
60
+	 * FilesDataHandler constructor.
61
+	 *
62
+	 * @param Request $request
63
+	 */
64
+	public function __construct(Request $request)
65
+	{
66
+		$this->request = $request;
67
+	}
68 68
 
69 69
 
70
-    /**
71
-     * @return CollectionInterface | FileSubmissionInterface[]
72
-     * @throws UnexpectedValueException
73
-     * @throws InvalidArgumentException
74
-     * @since 4.9.80.p
75
-     */
76
-    protected function getFileObjects()
77
-    {
78
-        $this->initialize();
79
-        return $this->file_objects;
80
-    }
70
+	/**
71
+	 * @return CollectionInterface | FileSubmissionInterface[]
72
+	 * @throws UnexpectedValueException
73
+	 * @throws InvalidArgumentException
74
+	 * @since 4.9.80.p
75
+	 */
76
+	protected function getFileObjects()
77
+	{
78
+		$this->initialize();
79
+		return $this->file_objects;
80
+	}
81 81
 
82 82
 
83
-    /**
84
-     * Sets up the file objects from the request's $_FILES data.
85
-     *
86
-     * @throws UnexpectedValueException
87
-     * @throws InvalidArgumentException
88
-     * @throws InvalidInterfaceException
89
-     * @since 4.9.80.p
90
-     */
91
-    protected function initialize()
92
-    {
93
-        if ($this->initialized) {
94
-            return;
95
-        }
96
-        $this->file_objects = new Collection(
97
-        // collection interface
98
-            'EventEspresso\core\services\request\files\FileSubmissionInterface',
99
-            // collection name
100
-            'submitted_files'
101
-        );
102
-        $files_raw_data     = $this->request->filesParams();
103
-        if (empty($files_raw_data)) {
104
-            return;
105
-        }
106
-        if ($this->isStrangeFilesArray($files_raw_data)) {
107
-            $data = $this->fixFilesDataArray($files_raw_data);
108
-        } else {
109
-            $data = $files_raw_data;
110
-        }
111
-        $this->createFileObjects($data);
112
-        $this->initialized = true;
113
-    }
83
+	/**
84
+	 * Sets up the file objects from the request's $_FILES data.
85
+	 *
86
+	 * @throws UnexpectedValueException
87
+	 * @throws InvalidArgumentException
88
+	 * @throws InvalidInterfaceException
89
+	 * @since 4.9.80.p
90
+	 */
91
+	protected function initialize()
92
+	{
93
+		if ($this->initialized) {
94
+			return;
95
+		}
96
+		$this->file_objects = new Collection(
97
+		// collection interface
98
+			'EventEspresso\core\services\request\files\FileSubmissionInterface',
99
+			// collection name
100
+			'submitted_files'
101
+		);
102
+		$files_raw_data     = $this->request->filesParams();
103
+		if (empty($files_raw_data)) {
104
+			return;
105
+		}
106
+		if ($this->isStrangeFilesArray($files_raw_data)) {
107
+			$data = $this->fixFilesDataArray($files_raw_data);
108
+		} else {
109
+			$data = $files_raw_data;
110
+		}
111
+		$this->createFileObjects($data);
112
+		$this->initialized = true;
113
+	}
114 114
 
115 115
 
116
-    /**
117
-     * Detects if $_FILES is a weird multi-dimensional array that needs fixing or not.
118
-     *
119
-     * @param $files_data
120
-     * @return bool
121
-     * @throws UnexpectedValueException
122
-     * @since 4.9.80.p
123
-     */
124
-    protected function isStrangeFilesArray($files_data)
125
-    {
126
-        if (! is_array($files_data)) {
127
-            throw new UnexpectedValueException(
128
-                sprintf(
129
-                    esc_html__(
130
-                        'Unexpected PHP $_FILES data format. "%1$s" was expected to be an array.',
131
-                        'event_espresso'
132
-                    ),
133
-                    (string) $files_data
134
-                )
135
-            );
136
-        }
137
-        $first_value = reset($files_data);
138
-        if (! is_array($first_value)) {
139
-            throw new UnexpectedValueException(
140
-                sprintf(
141
-                    esc_html__(
142
-                        'Unexpected PHP $_FILES data format. "%1$s" was expected to be an array.',
143
-                        'event_espresso'
144
-                    ),
145
-                    (string) $first_value
146
-                )
147
-            );
148
-        }
149
-        $first_sub_array_item = reset($first_value);
150
-        if (is_array($first_sub_array_item)) {
151
-            // not just a 2d array
152
-            return true;
153
-        }
154
-        // yep, just 2d array
155
-        return false;
156
-    }
116
+	/**
117
+	 * Detects if $_FILES is a weird multi-dimensional array that needs fixing or not.
118
+	 *
119
+	 * @param $files_data
120
+	 * @return bool
121
+	 * @throws UnexpectedValueException
122
+	 * @since 4.9.80.p
123
+	 */
124
+	protected function isStrangeFilesArray($files_data)
125
+	{
126
+		if (! is_array($files_data)) {
127
+			throw new UnexpectedValueException(
128
+				sprintf(
129
+					esc_html__(
130
+						'Unexpected PHP $_FILES data format. "%1$s" was expected to be an array.',
131
+						'event_espresso'
132
+					),
133
+					(string) $files_data
134
+				)
135
+			);
136
+		}
137
+		$first_value = reset($files_data);
138
+		if (! is_array($first_value)) {
139
+			throw new UnexpectedValueException(
140
+				sprintf(
141
+					esc_html__(
142
+						'Unexpected PHP $_FILES data format. "%1$s" was expected to be an array.',
143
+						'event_espresso'
144
+					),
145
+					(string) $first_value
146
+				)
147
+			);
148
+		}
149
+		$first_sub_array_item = reset($first_value);
150
+		if (is_array($first_sub_array_item)) {
151
+			// not just a 2d array
152
+			return true;
153
+		}
154
+		// yep, just 2d array
155
+		return false;
156
+	}
157 157
 
158 158
 
159
-    /**
160
-     * Takes into account that $_FILES does a weird thing when you have hierarchical form names (eg `<input type="file"
161
-     * name="my[hierarchical][form]">`): it leaves the top-level form part alone, but replaces the SECOND part with
162
-     * "name", "size", "tmp_name", etc. So that file's data is located at "my[name][hierarchical][form]",
163
-     * "my[size][hierarchical][form]", "my[tmp_name][hierarchical][form]", etc. It's really weird.
164
-     *
165
-     * @param $files_data
166
-     * @return array
167
-     * @since 4.9.80.p
168
-     */
169
-    protected function fixFilesDataArray($files_data)
170
-    {
171
-        $sane_files_array = [];
172
-        foreach ($files_data as $top_level_name => $top_level_children) {
173
-            $sub_array                           = [];
174
-            $sane_files_array[ $top_level_name ] = [];
175
-            foreach ($top_level_children as $file_data_part => $second_level_children) {
176
-                foreach ($second_level_children as $next_level_name => $sub_values) {
177
-                    $sub_array[ $next_level_name ] = $this->organizeFilesData($sub_values, $file_data_part);
178
-                }
179
-                $sane_files_array[ $top_level_name ] = array_replace_recursive(
180
-                    $sub_array,
181
-                    $sane_files_array[ $top_level_name ]
182
-                );
183
-            }
184
-        }
185
-        return $sane_files_array;
186
-    }
159
+	/**
160
+	 * Takes into account that $_FILES does a weird thing when you have hierarchical form names (eg `<input type="file"
161
+	 * name="my[hierarchical][form]">`): it leaves the top-level form part alone, but replaces the SECOND part with
162
+	 * "name", "size", "tmp_name", etc. So that file's data is located at "my[name][hierarchical][form]",
163
+	 * "my[size][hierarchical][form]", "my[tmp_name][hierarchical][form]", etc. It's really weird.
164
+	 *
165
+	 * @param $files_data
166
+	 * @return array
167
+	 * @since 4.9.80.p
168
+	 */
169
+	protected function fixFilesDataArray($files_data)
170
+	{
171
+		$sane_files_array = [];
172
+		foreach ($files_data as $top_level_name => $top_level_children) {
173
+			$sub_array                           = [];
174
+			$sane_files_array[ $top_level_name ] = [];
175
+			foreach ($top_level_children as $file_data_part => $second_level_children) {
176
+				foreach ($second_level_children as $next_level_name => $sub_values) {
177
+					$sub_array[ $next_level_name ] = $this->organizeFilesData($sub_values, $file_data_part);
178
+				}
179
+				$sane_files_array[ $top_level_name ] = array_replace_recursive(
180
+					$sub_array,
181
+					$sane_files_array[ $top_level_name ]
182
+				);
183
+			}
184
+		}
185
+		return $sane_files_array;
186
+	}
187 187
 
188 188
 
189
-    /**
190
-     * Recursively explores the array until it finds a leaf node, and tacks `$type` as a final index in front of it.
191
-     *
192
-     * @param $data array|string
193
-     * @param $type 'name', 'tmp_name', 'size', or 'error'
194
-     * @return array
195
-     * @since 4.9.80.p
196
-     */
197
-    protected function organizeFilesData($data, $type)
198
-    {
199
-        if (! is_array($data)) {
200
-            return [
201
-                $type => $data,
202
-            ];
203
-        }
204
-        $organized_data = [];
205
-        foreach ($data as $input_name_part => $sub_inputs_or_value) {
206
-            if (is_array($sub_inputs_or_value)) {
207
-                $organized_data[ $input_name_part ] = $this->organizeFilesData($sub_inputs_or_value, $type);
208
-            } else {
209
-                $organized_data[ $input_name_part ][ $type ] = $sub_inputs_or_value;
210
-            }
211
-        }
212
-        return $organized_data;
213
-    }
189
+	/**
190
+	 * Recursively explores the array until it finds a leaf node, and tacks `$type` as a final index in front of it.
191
+	 *
192
+	 * @param $data array|string
193
+	 * @param $type 'name', 'tmp_name', 'size', or 'error'
194
+	 * @return array
195
+	 * @since 4.9.80.p
196
+	 */
197
+	protected function organizeFilesData($data, $type)
198
+	{
199
+		if (! is_array($data)) {
200
+			return [
201
+				$type => $data,
202
+			];
203
+		}
204
+		$organized_data = [];
205
+		foreach ($data as $input_name_part => $sub_inputs_or_value) {
206
+			if (is_array($sub_inputs_or_value)) {
207
+				$organized_data[ $input_name_part ] = $this->organizeFilesData($sub_inputs_or_value, $type);
208
+			} else {
209
+				$organized_data[ $input_name_part ][ $type ] = $sub_inputs_or_value;
210
+			}
211
+		}
212
+		return $organized_data;
213
+	}
214 214
 
215 215
 
216
-    /**
217
-     * Takes the organized $_FILES array (where all file info is located at the same spot as you'd expect an input
218
-     * to be in post data, with all the file's data located side-by-side in an array) and creates a
219
-     * multi-dimensional array of FileSubmissionInterface objects. Stores it in `$this->file_objects`.
220
-     *
221
-     * @param array $organized_files   $_FILES but organized like $_POST
222
-     * @param array $name_parts_so_far for multidimensional HTML form names,
223
-     * @throws UnexpectedValueException
224
-     * @throws InvalidArgumentException
225
-     * @since 4.9.80.p
226
-     */
227
-    protected function createFileObjects($organized_files, $name_parts_so_far = [])
228
-    {
229
-        if (! is_array($organized_files)) {
230
-            throw new UnexpectedValueException(
231
-                sprintf(
232
-                    esc_html__(
233
-                        'Unexpected PHP $organized_files data format. "%1$s" was expected to be an array.',
234
-                        'event_espresso'
235
-                    ),
236
-                    (string) $organized_files
237
-                )
238
-            );
239
-        }
240
-        foreach ($organized_files as $key => $value) {
241
-            $this_input_name_parts = $name_parts_so_far;
242
-            array_push(
243
-                $this_input_name_parts,
244
-                $key
245
-            );
246
-            if (isset($value['name'], $value['tmp_name'], $value['size'])) {
247
-                $html_name = $this->inputNameFromParts($this_input_name_parts);
248
-                $this->file_objects->add(
249
-                    new FileSubmission(
250
-                        $value['name'],
251
-                        $value['tmp_name'],
252
-                        $value['size'],
253
-                        $value['error']
254
-                    ),
255
-                    $html_name
256
-                );
257
-            } else {
258
-                $this->createFileObjects($value, $this_input_name_parts);
259
-            }
260
-        }
261
-    }
216
+	/**
217
+	 * Takes the organized $_FILES array (where all file info is located at the same spot as you'd expect an input
218
+	 * to be in post data, with all the file's data located side-by-side in an array) and creates a
219
+	 * multi-dimensional array of FileSubmissionInterface objects. Stores it in `$this->file_objects`.
220
+	 *
221
+	 * @param array $organized_files   $_FILES but organized like $_POST
222
+	 * @param array $name_parts_so_far for multidimensional HTML form names,
223
+	 * @throws UnexpectedValueException
224
+	 * @throws InvalidArgumentException
225
+	 * @since 4.9.80.p
226
+	 */
227
+	protected function createFileObjects($organized_files, $name_parts_so_far = [])
228
+	{
229
+		if (! is_array($organized_files)) {
230
+			throw new UnexpectedValueException(
231
+				sprintf(
232
+					esc_html__(
233
+						'Unexpected PHP $organized_files data format. "%1$s" was expected to be an array.',
234
+						'event_espresso'
235
+					),
236
+					(string) $organized_files
237
+				)
238
+			);
239
+		}
240
+		foreach ($organized_files as $key => $value) {
241
+			$this_input_name_parts = $name_parts_so_far;
242
+			array_push(
243
+				$this_input_name_parts,
244
+				$key
245
+			);
246
+			if (isset($value['name'], $value['tmp_name'], $value['size'])) {
247
+				$html_name = $this->inputNameFromParts($this_input_name_parts);
248
+				$this->file_objects->add(
249
+					new FileSubmission(
250
+						$value['name'],
251
+						$value['tmp_name'],
252
+						$value['size'],
253
+						$value['error']
254
+					),
255
+					$html_name
256
+				);
257
+			} else {
258
+				$this->createFileObjects($value, $this_input_name_parts);
259
+			}
260
+		}
261
+	}
262 262
 
263 263
 
264
-    /**
265
-     * Takes the input name parts, like `['my', 'great', 'file', 'input1']`
266
-     * and returns the HTML name for it, "my[great][file][input1]"
267
-     *
268
-     * @throws UnexpectedValueException
269
-     * @since 4.9.80.p
270
-     */
271
-    protected function inputNameFromParts($parts)
272
-    {
273
-        if (! is_array($parts)) {
274
-            throw new UnexpectedValueException(esc_html__('Name parts should be an array.', 'event_espresso'));
275
-        }
276
-        $generated_string = '';
277
-        foreach ($parts as $part) {
278
-            $part = (string) $part;
279
-            // wrap all but the first part in []
280
-            $generated_string .= $generated_string === '' ? $part : '[' . $part . ']';
281
-        }
282
-        return $generated_string;
283
-    }
264
+	/**
265
+	 * Takes the input name parts, like `['my', 'great', 'file', 'input1']`
266
+	 * and returns the HTML name for it, "my[great][file][input1]"
267
+	 *
268
+	 * @throws UnexpectedValueException
269
+	 * @since 4.9.80.p
270
+	 */
271
+	protected function inputNameFromParts($parts)
272
+	{
273
+		if (! is_array($parts)) {
274
+			throw new UnexpectedValueException(esc_html__('Name parts should be an array.', 'event_espresso'));
275
+		}
276
+		$generated_string = '';
277
+		foreach ($parts as $part) {
278
+			$part = (string) $part;
279
+			// wrap all but the first part in []
280
+			$generated_string .= $generated_string === '' ? $part : '[' . $part . ']';
281
+		}
282
+		return $generated_string;
283
+	}
284 284
 
285 285
 
286
-    /**
287
-     * Gets the input by the indicated $name_parts.
288
-     * Eg if you're looking for an input named "my[great][file][input1]", $name_parts
289
-     * should be `['my', 'great', 'file', 'input1']`.
290
-     * Alternatively, you could use `FileDataHandler::getFileObject('my[great][file][input1]');`
291
-     *
292
-     * @param $name_parts
293
-     * @return FileSubmissionInterface
294
-     * @throws UnexpectedValueException
295
-     * @since 4.9.80.p
296
-     */
297
-    public function getFileObjectFromNameParts($name_parts)
298
-    {
299
-        return $this->getFileObjects()->get($this->inputNameFromParts($name_parts));
300
-    }
286
+	/**
287
+	 * Gets the input by the indicated $name_parts.
288
+	 * Eg if you're looking for an input named "my[great][file][input1]", $name_parts
289
+	 * should be `['my', 'great', 'file', 'input1']`.
290
+	 * Alternatively, you could use `FileDataHandler::getFileObject('my[great][file][input1]');`
291
+	 *
292
+	 * @param $name_parts
293
+	 * @return FileSubmissionInterface
294
+	 * @throws UnexpectedValueException
295
+	 * @since 4.9.80.p
296
+	 */
297
+	public function getFileObjectFromNameParts($name_parts)
298
+	{
299
+		return $this->getFileObjects()->get($this->inputNameFromParts($name_parts));
300
+	}
301 301
 
302 302
 
303
-    /**
304
-     * Gets the FileSubmissionInterface corresponding to the HTML name provided.
305
-     *
306
-     * @param $html_name
307
-     * @return mixed
308
-     * @throws InvalidArgumentException
309
-     * @throws UnexpectedValueException
310
-     * @since 4.9.80.p
311
-     */
312
-    public function getFileObject($html_name)
313
-    {
314
-        return $this->getFileObjects()->get($html_name);
315
-    }
303
+	/**
304
+	 * Gets the FileSubmissionInterface corresponding to the HTML name provided.
305
+	 *
306
+	 * @param $html_name
307
+	 * @return mixed
308
+	 * @throws InvalidArgumentException
309
+	 * @throws UnexpectedValueException
310
+	 * @since 4.9.80.p
311
+	 */
312
+	public function getFileObject($html_name)
313
+	{
314
+		return $this->getFileObjects()->get($html_name);
315
+	}
316 316
 }
317 317
 // End of file FilesDataHandler.php
318 318
 // Location: EventEspresso\core\services\request\files/FilesDataHandler.php
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             // collection name
100 100
             'submitted_files'
101 101
         );
102
-        $files_raw_data     = $this->request->filesParams();
102
+        $files_raw_data = $this->request->filesParams();
103 103
         if (empty($files_raw_data)) {
104 104
             return;
105 105
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     protected function isStrangeFilesArray($files_data)
125 125
     {
126
-        if (! is_array($files_data)) {
126
+        if ( ! is_array($files_data)) {
127 127
             throw new UnexpectedValueException(
128 128
                 sprintf(
129 129
                     esc_html__(
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             );
136 136
         }
137 137
         $first_value = reset($files_data);
138
-        if (! is_array($first_value)) {
138
+        if ( ! is_array($first_value)) {
139 139
             throw new UnexpectedValueException(
140 140
                 sprintf(
141 141
                     esc_html__(
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
         $sane_files_array = [];
172 172
         foreach ($files_data as $top_level_name => $top_level_children) {
173 173
             $sub_array                           = [];
174
-            $sane_files_array[ $top_level_name ] = [];
174
+            $sane_files_array[$top_level_name] = [];
175 175
             foreach ($top_level_children as $file_data_part => $second_level_children) {
176 176
                 foreach ($second_level_children as $next_level_name => $sub_values) {
177
-                    $sub_array[ $next_level_name ] = $this->organizeFilesData($sub_values, $file_data_part);
177
+                    $sub_array[$next_level_name] = $this->organizeFilesData($sub_values, $file_data_part);
178 178
                 }
179
-                $sane_files_array[ $top_level_name ] = array_replace_recursive(
179
+                $sane_files_array[$top_level_name] = array_replace_recursive(
180 180
                     $sub_array,
181
-                    $sane_files_array[ $top_level_name ]
181
+                    $sane_files_array[$top_level_name]
182 182
                 );
183 183
             }
184 184
         }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     protected function organizeFilesData($data, $type)
198 198
     {
199
-        if (! is_array($data)) {
199
+        if ( ! is_array($data)) {
200 200
             return [
201 201
                 $type => $data,
202 202
             ];
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
         $organized_data = [];
205 205
         foreach ($data as $input_name_part => $sub_inputs_or_value) {
206 206
             if (is_array($sub_inputs_or_value)) {
207
-                $organized_data[ $input_name_part ] = $this->organizeFilesData($sub_inputs_or_value, $type);
207
+                $organized_data[$input_name_part] = $this->organizeFilesData($sub_inputs_or_value, $type);
208 208
             } else {
209
-                $organized_data[ $input_name_part ][ $type ] = $sub_inputs_or_value;
209
+                $organized_data[$input_name_part][$type] = $sub_inputs_or_value;
210 210
             }
211 211
         }
212 212
         return $organized_data;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function createFileObjects($organized_files, $name_parts_so_far = [])
228 228
     {
229
-        if (! is_array($organized_files)) {
229
+        if ( ! is_array($organized_files)) {
230 230
             throw new UnexpectedValueException(
231 231
                 sprintf(
232 232
                     esc_html__(
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
      */
271 271
     protected function inputNameFromParts($parts)
272 272
     {
273
-        if (! is_array($parts)) {
273
+        if ( ! is_array($parts)) {
274 274
             throw new UnexpectedValueException(esc_html__('Name parts should be an array.', 'event_espresso'));
275 275
         }
276 276
         $generated_string = '';
277 277
         foreach ($parts as $part) {
278 278
             $part = (string) $part;
279 279
             // wrap all but the first part in []
280
-            $generated_string .= $generated_string === '' ? $part : '[' . $part . ']';
280
+            $generated_string .= $generated_string === '' ? $part : '['.$part.']';
281 281
         }
282 282
         return $generated_string;
283 283
     }
Please login to merge, or discard this patch.
core/espresso_definitions.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 define('EE_SUPPORT_EMAIL', '[email protected]');
8 8
 // used to be DIRECTORY_SEPARATOR, but that caused issues on windows
9 9
 if (! defined('DS')) {
10
-    define('DS', '/');
10
+	define('DS', '/');
11 11
 }
12 12
 if (! defined('PS')) {
13
-    define('PS', PATH_SEPARATOR);
13
+	define('PS', PATH_SEPARATOR);
14 14
 }
15 15
 if (! defined('SP')) {
16
-    define('SP', ' ');
16
+	define('SP', ' ');
17 17
 }
18 18
 if (! defined('EENL')) {
19
-    define('EENL', "\n");
19
+	define('EENL', "\n");
20 20
 }
21 21
 // define the plugin directory and URL
22 22
 define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages/');
71 71
 // check for DOMPDF fonts in uploads
72 72
 if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/')) {
73
-    define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/');
73
+	define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/');
74 74
 }
75 75
 // just a handy constant occasionally needed for finding values representing infinity in the DB
76 76
 // you're better to use this than its straight value (currently -1) in case you ever
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 define('EE_INF_IN_DB', -1);
79 79
 define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
80 80
 if (! defined('EE_DEBUG')) {
81
-    define('EE_DEBUG', false);
81
+	define('EE_DEBUG', false);
82 82
 }
83 83
 // for older WP versions
84 84
 if (! defined('MONTH_IN_SECONDS')) {
85
-    define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
85
+	define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
86 86
 }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -7,78 +7,78 @@
 block discarded – undo
7 7
 define('EE_MIN_PHP_VER_RECOMMENDED', '7.4');
8 8
 define('EE_SUPPORT_EMAIL', '[email protected]');
9 9
 // used to be DIRECTORY_SEPARATOR, but that caused issues on windows
10
-if (! defined('DS')) {
10
+if ( ! defined('DS')) {
11 11
     define('DS', '/');
12 12
 }
13
-if (! defined('PS')) {
13
+if ( ! defined('PS')) {
14 14
     define('PS', PATH_SEPARATOR);
15 15
 }
16
-if (! defined('SP')) {
16
+if ( ! defined('SP')) {
17 17
     define('SP', ' ');
18 18
 }
19
-if (! defined('EENL')) {
19
+if ( ! defined('EENL')) {
20 20
     define('EENL', "\n");
21 21
 }
22 22
 // define the plugin directory and URL
23 23
 define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
24
-define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE) . '/');
24
+define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE).'/');
25 25
 define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
26 26
 // main root folder paths
27
-define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages/');
28
-define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core/');
29
-define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules/');
30
-define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public/');
31
-define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes/');
32
-define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets/');
33
-define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods/');
34
-define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated/');
27
+define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages/');
28
+define('EE_CORE', EE_PLUGIN_DIR_PATH.'core/');
29
+define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules/');
30
+define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public/');
31
+define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes/');
32
+define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets/');
33
+define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods/');
34
+define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated/');
35 35
 // core system paths
36
-define('EE_ADMIN', EE_CORE . 'admin/');
37
-define('EE_CPTS', EE_CORE . 'CPTs/');
38
-define('EE_CLASSES', EE_CORE . 'db_classes/');
39
-define('EE_INTERFACES', EE_CORE . 'interfaces/');
40
-define('EE_BUSINESS', EE_CORE . 'business/');
41
-define('EE_MODELS', EE_CORE . 'db_models/');
42
-define('EE_HELPERS', EE_CORE . 'helpers/');
43
-define('EE_LIBRARIES', EE_CORE . 'libraries/');
44
-define('EE_TEMPLATES', EE_CORE . 'templates/');
45
-define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs/');
46
-define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets/');
47
-define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections/');
36
+define('EE_ADMIN', EE_CORE.'admin/');
37
+define('EE_CPTS', EE_CORE.'CPTs/');
38
+define('EE_CLASSES', EE_CORE.'db_classes/');
39
+define('EE_INTERFACES', EE_CORE.'interfaces/');
40
+define('EE_BUSINESS', EE_CORE.'business/');
41
+define('EE_MODELS', EE_CORE.'db_models/');
42
+define('EE_HELPERS', EE_CORE.'helpers/');
43
+define('EE_LIBRARIES', EE_CORE.'libraries/');
44
+define('EE_TEMPLATES', EE_CORE.'templates/');
45
+define('EE_THIRD_PARTY', EE_CORE.'third_party_libs/');
46
+define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets/');
47
+define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections/');
48 48
 // gateways
49
-define('EE_GATEWAYS', EE_MODULES . 'gateways/');
50
-define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules/gateways/');
49
+define('EE_GATEWAYS', EE_MODULES.'gateways/');
50
+define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules/gateways/');
51 51
 // asset URL paths
52
-define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core/templates/');
53
-define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets/');
54
-define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images/');
55
-define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core/third_party_libs/');
56
-define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
57
-define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
52
+define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core/templates/');
53
+define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets/');
54
+define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images/');
55
+define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core/third_party_libs/');
56
+define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
57
+define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
58 58
 // define upload paths
59 59
 $uploads = wp_upload_dir();
60 60
 // define the uploads directory and URL
61
-define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . '/espresso/');
62
-define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . '/espresso/');
61
+define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].'/espresso/');
62
+define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].'/espresso/');
63 63
 // define the templates directory and URL
64
-define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . '/espresso/templates/');
65
-define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . '/espresso/templates/');
64
+define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].'/espresso/templates/');
65
+define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].'/espresso/templates/');
66 66
 // languages folder/path
67
-define('EE_LANGUAGES_SAFE_LOC', '../' . 'uploads/' . 'espresso/languages/');
68
-define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages/');
67
+define('EE_LANGUAGES_SAFE_LOC', '../'.'uploads/'.'espresso/languages/');
68
+define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages/');
69 69
 // check for DOMPDF fonts in uploads
70
-if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/')) {
71
-    define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/');
70
+if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts/')) {
71
+    define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts/');
72 72
 }
73 73
 // just a handy constant occasionally needed for finding values representing infinity in the DB
74 74
 // you're better to use this than its straight value (currently -1) in case you ever
75 75
 // want to change its default value! or find when -1 means infinity
76 76
 define('EE_INF_IN_DB', -1);
77 77
 define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
78
-if (! defined('EE_DEBUG')) {
78
+if ( ! defined('EE_DEBUG')) {
79 79
     define('EE_DEBUG', false);
80 80
 }
81 81
 // for older WP versions
82
-if (! defined('MONTH_IN_SECONDS')) {
82
+if ( ! defined('MONTH_IN_SECONDS')) {
83 83
     define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
84 84
 }
Please login to merge, or discard this patch.
core/EE_Log.core.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public static function instance()
50 50
     {
51
-        if (! self::$_instance instanceof EE_Log) {
51
+        if ( ! self::$_instance instanceof EE_Log) {
52 52
             self::$_instance = new self();
53 53
         }
54 54
         return self::$_instance;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     private function __construct()
62 62
     {
63 63
 
64
-        if (! EE_Registry::instance()->CFG->admin->use_remote_logging) {
64
+        if ( ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
65 65
             return;
66 66
         }
67 67
 
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      */
106 106
     private function _format_message($file = '', $function = '', $message = '', $type = '')
107 107
     {
108
-        $msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
109
-        $msg .= '[' . current_time('mysql') . '] ';
108
+        $msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
109
+        $msg .= '['.current_time('mysql').'] ';
110 110
         $msg .= ! empty($file) ? basename($file) : '';
111 111
         $msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
112
-        $msg .= ! empty($function) ? $function . '()' : '';
112
+        $msg .= ! empty($function) ? $function.'()' : '';
113 113
         $msg .= PHP_EOL;
114 114
         $type = ! empty($type) ? $type : 'log message';
115
-        $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
115
+        $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
116 116
         return $msg;
117 117
     }
118 118
 
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 
165 165
         /** @var RequestInterface $request */
166 166
         $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
167
-        $data = 'domain=' . $request->getServerParam('HTTP_HOST');
168
-        $data .= '&ip=' . $request->getServerParam('SERVER_ADDR');
169
-        $data .= '&server_type=' . $request->getServerParam('SERVER_SOFTWARE');
170
-        $data .= '&time=' . time();
171
-        $data .= '&remote_log=' . $this->_log;
167
+        $data = 'domain='.$request->getServerParam('HTTP_HOST');
168
+        $data .= '&ip='.$request->getServerParam('SERVER_ADDR');
169
+        $data .= '&server_type='.$request->getServerParam('SERVER_SOFTWARE');
170
+        $data .= '&time='.time();
171
+        $data .= '&remote_log='.$this->_log;
172 172
         $data .= '&action=save';
173 173
 
174 174
         if (defined('EELOGGING_PASS')) {
175
-            $data .= '&pass=' . EELOGGING_PASS;
175
+            $data .= '&pass='.EELOGGING_PASS;
176 176
         }
177 177
         if (defined('EELOGGING_KEY')) {
178
-            $data .= '&key=' . EELOGGING_KEY;
178
+            $data .= '&key='.EELOGGING_KEY;
179 179
         }
180 180
 
181 181
         $c = curl_init($this->_remote_logging_url);
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -19,197 +19,197 @@
 block discarded – undo
19 19
  */
20 20
 class EE_Log
21 21
 {
22
-    /**
23
-     * @var string
24
-     */
25
-    private $_log = '';
26
-
27
-    /**
28
-     * Used for remote logging
29
-     *
30
-     * @var string
31
-     */
32
-    private $_remote_logging_url = '';
33
-
34
-    /**
35
-     * @var string
36
-     */
37
-    private $_remote_log = '';
38
-
39
-    /**
40
-     * @var EE_Log
41
-     */
42
-    private static $_instance;
43
-
44
-
45
-    /**
46
-     * @return EE_Log
47
-     */
48
-    public static function instance()
49
-    {
50
-        if (! self::$_instance instanceof EE_Log) {
51
-            self::$_instance = new self();
52
-        }
53
-        return self::$_instance;
54
-    }
55
-
56
-    /**
57
-     * @access private
58
-     * @return EE_Log
59
-     */
60
-    private function __construct()
61
-    {
62
-
63
-        if (! EE_Registry::instance()->CFG->admin->use_remote_logging) {
64
-            return;
65
-        }
66
-
67
-        $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
68
-        $this->_remote_log = '';
69
-
70
-        if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
71
-            add_action('shutdown', array($this, 'send_log'), 9999);
72
-        }
73
-    }
74
-
75
-
76
-    /**
77
-     *    verify_filesystem
78
-     * tests that the required files and folders exist and are writable
79
-     *
80
-     */
81
-    public function verify_filesystem()
82
-    {
83
-        $msg = esc_html__(
84
-            'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.',
85
-            'event_espresso'
86
-        );
87
-        EE_Error::doing_it_wrong(
88
-            __METHOD__,
89
-            $msg,
90
-            '4.10.1.p'
91
-        );
92
-    }
93
-
94
-
95
-    /**
96
-     *    _format_message
97
-     *    makes yer log entries look all purdy
98
-     *
99
-     * @param string $file
100
-     * @param string $function
101
-     * @param string $message
102
-     * @param string $type
103
-     * @return string
104
-     */
105
-    private function _format_message($file = '', $function = '', $message = '', $type = '')
106
-    {
107
-        $msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
108
-        $msg .= '[' . current_time('mysql') . '] ';
109
-        $msg .= ! empty($file) ? basename($file) : '';
110
-        $msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
111
-        $msg .= ! empty($function) ? $function . '()' : '';
112
-        $msg .= PHP_EOL;
113
-        $type = ! empty($type) ? $type : 'log message';
114
-        $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
115
-        return $msg;
116
-    }
117
-
118
-
119
-    /**
120
-     *    log
121
-     * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the
122
-     * EE_Log::write_log() callback
123
-     *
124
-     * @param string $file
125
-     * @param string $function
126
-     * @param string $message
127
-     * @param string $type
128
-     */
129
-    public function log($file = '', $function = '', $message = '', $type = '')
130
-    {
131
-        $this->_log .= $this->_format_message($file, $function, $message, $type);
132
-    }
133
-
134
-
135
-    /**
136
-     * write_log
137
-     * appends the results of the 'AHEE_log' filter to the espresso log file
138
-     */
139
-    public function write_log()
140
-    {
141
-        $msg = esc_html__(
142
-            'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.',
143
-            'event_espresso'
144
-        );
145
-        EE_Error::doing_it_wrong(
146
-            __METHOD__,
147
-            $msg,
148
-            '4.10.1.p'
149
-        );
150
-    }
151
-
152
-
153
-    /**
154
-     * send_log
155
-     * sends the espresso log to a remote URL via a PHP cURL request
156
-     */
157
-    public function send_log()
158
-    {
159
-
160
-        if (empty($this->_remote_logging_url)) {
161
-            return;
162
-        }
163
-
164
-        /** @var RequestInterface $request */
165
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
166
-        $data = 'domain=' . $request->getServerParam('HTTP_HOST');
167
-        $data .= '&ip=' . $request->getServerParam('SERVER_ADDR');
168
-        $data .= '&server_type=' . $request->getServerParam('SERVER_SOFTWARE');
169
-        $data .= '&time=' . time();
170
-        $data .= '&remote_log=' . $this->_log;
171
-        $data .= '&action=save';
172
-
173
-        if (defined('EELOGGING_PASS')) {
174
-            $data .= '&pass=' . EELOGGING_PASS;
175
-        }
176
-        if (defined('EELOGGING_KEY')) {
177
-            $data .= '&key=' . EELOGGING_KEY;
178
-        }
179
-
180
-        $c = curl_init($this->_remote_logging_url);
181
-        curl_setopt($c, CURLOPT_POST, true);
182
-        curl_setopt($c, CURLOPT_POSTFIELDS, $data);
183
-        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
184
-        curl_exec($c);
185
-        curl_close($c);
186
-    }
187
-
188
-
189
-    /**
190
-     * write_debug
191
-     * writes the contents of the current request's data to a log file.
192
-     * previous entries are overwritten
193
-     */
194
-    public function write_debug()
195
-    {
196
-        $msg = esc_html__(
197
-            'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.',
198
-            'event_espresso'
199
-        );
200
-        EE_Error::doing_it_wrong(
201
-            __METHOD__,
202
-            $msg,
203
-            '4.10.1.p'
204
-        );
205
-    }
206
-
207
-
208
-    /**
209
-     * __clone
210
-     */
211
-    public function __clone()
212
-    {
213
-        trigger_error(esc_html__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
214
-    }
22
+	/**
23
+	 * @var string
24
+	 */
25
+	private $_log = '';
26
+
27
+	/**
28
+	 * Used for remote logging
29
+	 *
30
+	 * @var string
31
+	 */
32
+	private $_remote_logging_url = '';
33
+
34
+	/**
35
+	 * @var string
36
+	 */
37
+	private $_remote_log = '';
38
+
39
+	/**
40
+	 * @var EE_Log
41
+	 */
42
+	private static $_instance;
43
+
44
+
45
+	/**
46
+	 * @return EE_Log
47
+	 */
48
+	public static function instance()
49
+	{
50
+		if (! self::$_instance instanceof EE_Log) {
51
+			self::$_instance = new self();
52
+		}
53
+		return self::$_instance;
54
+	}
55
+
56
+	/**
57
+	 * @access private
58
+	 * @return EE_Log
59
+	 */
60
+	private function __construct()
61
+	{
62
+
63
+		if (! EE_Registry::instance()->CFG->admin->use_remote_logging) {
64
+			return;
65
+		}
66
+
67
+		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
68
+		$this->_remote_log = '';
69
+
70
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
71
+			add_action('shutdown', array($this, 'send_log'), 9999);
72
+		}
73
+	}
74
+
75
+
76
+	/**
77
+	 *    verify_filesystem
78
+	 * tests that the required files and folders exist and are writable
79
+	 *
80
+	 */
81
+	public function verify_filesystem()
82
+	{
83
+		$msg = esc_html__(
84
+			'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.',
85
+			'event_espresso'
86
+		);
87
+		EE_Error::doing_it_wrong(
88
+			__METHOD__,
89
+			$msg,
90
+			'4.10.1.p'
91
+		);
92
+	}
93
+
94
+
95
+	/**
96
+	 *    _format_message
97
+	 *    makes yer log entries look all purdy
98
+	 *
99
+	 * @param string $file
100
+	 * @param string $function
101
+	 * @param string $message
102
+	 * @param string $type
103
+	 * @return string
104
+	 */
105
+	private function _format_message($file = '', $function = '', $message = '', $type = '')
106
+	{
107
+		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
108
+		$msg .= '[' . current_time('mysql') . '] ';
109
+		$msg .= ! empty($file) ? basename($file) : '';
110
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
111
+		$msg .= ! empty($function) ? $function . '()' : '';
112
+		$msg .= PHP_EOL;
113
+		$type = ! empty($type) ? $type : 'log message';
114
+		$msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
115
+		return $msg;
116
+	}
117
+
118
+
119
+	/**
120
+	 *    log
121
+	 * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the
122
+	 * EE_Log::write_log() callback
123
+	 *
124
+	 * @param string $file
125
+	 * @param string $function
126
+	 * @param string $message
127
+	 * @param string $type
128
+	 */
129
+	public function log($file = '', $function = '', $message = '', $type = '')
130
+	{
131
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
132
+	}
133
+
134
+
135
+	/**
136
+	 * write_log
137
+	 * appends the results of the 'AHEE_log' filter to the espresso log file
138
+	 */
139
+	public function write_log()
140
+	{
141
+		$msg = esc_html__(
142
+			'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.',
143
+			'event_espresso'
144
+		);
145
+		EE_Error::doing_it_wrong(
146
+			__METHOD__,
147
+			$msg,
148
+			'4.10.1.p'
149
+		);
150
+	}
151
+
152
+
153
+	/**
154
+	 * send_log
155
+	 * sends the espresso log to a remote URL via a PHP cURL request
156
+	 */
157
+	public function send_log()
158
+	{
159
+
160
+		if (empty($this->_remote_logging_url)) {
161
+			return;
162
+		}
163
+
164
+		/** @var RequestInterface $request */
165
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
166
+		$data = 'domain=' . $request->getServerParam('HTTP_HOST');
167
+		$data .= '&ip=' . $request->getServerParam('SERVER_ADDR');
168
+		$data .= '&server_type=' . $request->getServerParam('SERVER_SOFTWARE');
169
+		$data .= '&time=' . time();
170
+		$data .= '&remote_log=' . $this->_log;
171
+		$data .= '&action=save';
172
+
173
+		if (defined('EELOGGING_PASS')) {
174
+			$data .= '&pass=' . EELOGGING_PASS;
175
+		}
176
+		if (defined('EELOGGING_KEY')) {
177
+			$data .= '&key=' . EELOGGING_KEY;
178
+		}
179
+
180
+		$c = curl_init($this->_remote_logging_url);
181
+		curl_setopt($c, CURLOPT_POST, true);
182
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
183
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
184
+		curl_exec($c);
185
+		curl_close($c);
186
+	}
187
+
188
+
189
+	/**
190
+	 * write_debug
191
+	 * writes the contents of the current request's data to a log file.
192
+	 * previous entries are overwritten
193
+	 */
194
+	public function write_debug()
195
+	{
196
+		$msg = esc_html__(
197
+			'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.',
198
+			'event_espresso'
199
+		);
200
+		EE_Error::doing_it_wrong(
201
+			__METHOD__,
202
+			$msg,
203
+			'4.10.1.p'
204
+		);
205
+	}
206
+
207
+
208
+	/**
209
+	 * __clone
210
+	 */
211
+	public function __clone()
212
+	{
213
+		trigger_error(esc_html__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
214
+	}
215 215
 }
Please login to merge, or discard this patch.
core/domain/entities/admin/GraphQLData/Venues.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function getData(array $where_params = [])
22 22
     {
23
-        $field_key = lcfirst($this->namespace) . 'Venues';
23
+        $field_key = lcfirst($this->namespace).'Venues';
24 24
         $query = <<<QUERY
25 25
         query GET_VENUES(\$where: RootQueryTo{$this->namespace}VenueConnectionWhereArgs, \$first: Int, \$last: Int ) {
26 26
             {$field_key}(where: \$where, first: \$first, last: \$last) {
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Venues extends GraphQLData
14 14
 {
15
-    /**
16
-     * @param array $where_params
17
-     * @return array|null
18
-     * @since $VID:$
19
-     */
20
-    public function getData(array $where_params = [])
21
-    {
22
-        $field_key = lcfirst($this->namespace) . 'Venues';
23
-        $query = <<<QUERY
15
+	/**
16
+	 * @param array $where_params
17
+	 * @return array|null
18
+	 * @since $VID:$
19
+	 */
20
+	public function getData(array $where_params = [])
21
+	{
22
+		$field_key = lcfirst($this->namespace) . 'Venues';
23
+		$query = <<<QUERY
24 24
         query GET_VENUES(\$where: RootQueryTo{$this->namespace}VenueConnectionWhereArgs, \$first: Int, \$last: Int ) {
25 25
             {$field_key}(where: \$where, first: \$first, last: \$last) {
26 26
                 nodes {
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
             }
50 50
         }
51 51
 QUERY;
52
-        $this->setParams([
53
-            'operation_name' => 'GET_VENUES',
54
-            'variables'      => [
55
-                'first' => 100,
56
-            ],
57
-            'query'          => $query,
58
-        ]);
52
+		$this->setParams([
53
+			'operation_name' => 'GET_VENUES',
54
+			'variables'      => [
55
+				'first' => 100,
56
+			],
57
+			'query'          => $query,
58
+		]);
59 59
 
60
-        return $this->getQueryResponse($field_key, $where_params);
61
-    }
60
+		return $this->getQueryResponse($field_key, $where_params);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/EventMutation.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
             $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
45 45
         }
46 46
 
47
-        if (! empty($input['defaultRegStatus'])) {
47
+        if ( ! empty($input['defaultRegStatus'])) {
48 48
             $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
49 49
         }
50 50
 
51
-        if (! empty($input['description'])) {
51
+        if ( ! empty($input['description'])) {
52 52
             $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db');
53 53
         }
54 54
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
61 61
         }
62 62
 
63
-        if (! empty($input['maxRegistrations'])) {
63
+        if ( ! empty($input['maxRegistrations'])) {
64 64
             $args['EVT_additional_limit'] = absint($input['maxRegistrations']);
65 65
         }
66 66
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
69 69
         }
70 70
 
71
-        if (! empty($input['name'])) {
71
+        if ( ! empty($input['name'])) {
72 72
             $args['EVT_name'] = sanitize_text_field($input['name']);
73 73
         }
74 74
 
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
             $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
89 89
         }
90 90
 
91
-        if (! empty($input['visibleOn'])) {
91
+        if ( ! empty($input['visibleOn'])) {
92 92
             $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn']));
93 93
         }
94 94
 
95
-        if (! empty($input['manager'])) {
95
+        if ( ! empty($input['manager'])) {
96 96
             $parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
97 97
             $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
98 98
         }
Please login to merge, or discard this patch.
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -20,113 +20,113 @@
 block discarded – undo
20 20
  */
21 21
 class EventMutation
22 22
 {
23
-    /**
24
-     * Maps the GraphQL input to a format that the model functions can use
25
-     *
26
-     * @param array  $input         Data coming from the GraphQL mutation query input
27
-     * @return array
28
-     * @throws Exception
29
-     */
30
-    public static function prepareFields(array $input): array
31
-    {
32
-        $args = [];
33
-
34
-        if (array_key_exists('allowDonations', $input)) {
35
-            $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN);
36
-        }
37
-
38
-        if (array_key_exists('allowOverflow', $input)) {
39
-            $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
40
-        }
41
-
42
-        if (array_key_exists('altRegPage', $input)) {
43
-            $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
44
-        }
45
-
46
-        if (! empty($input['defaultRegStatus'])) {
47
-            $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
48
-        }
49
-
50
-        if (! empty($input['description'])) {
51
-            $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db');
52
-        }
53
-
54
-        if (array_key_exists('displayDescription', $input)) {
55
-            $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN);
56
-        }
57
-
58
-        if (array_key_exists('displayTicketSelector', $input)) {
59
-            $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
60
-        }
61
-
62
-        if (! empty($input['maxRegistrations'])) {
63
-            $args['EVT_additional_limit'] = absint($input['maxRegistrations']);
64
-        }
65
-
66
-        if (array_key_exists('memberOnly', $input)) {
67
-            $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
68
-        }
69
-
70
-        if (! empty($input['name'])) {
71
-            $args['EVT_name'] = sanitize_text_field($input['name']);
72
-        }
73
-
74
-        if (array_key_exists('order', $input)) {
75
-            $args['EVT_order'] = absint($input['order']);
76
-        }
77
-
78
-        if (array_key_exists('phoneNumber', $input)) {
79
-            $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
80
-        }
81
-
82
-        if (array_key_exists('shortDescription', $input)) {
83
-            $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db');
84
-        }
85
-
86
-        if (array_key_exists('timezoneString', $input)) {
87
-            $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
88
-        }
89
-
90
-        if (! empty($input['visibleOn'])) {
91
-            $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn']));
92
-        }
93
-
94
-        if (! empty($input['manager'])) {
95
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
96
-            $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
97
-        }
98
-
99
-        if (array_key_exists('venue', $input)) {
100
-            $venue_id = sanitize_text_field($input['venue']);
101
-            $parts = Relay::fromGlobalId($venue_id);
102
-            $args['venue'] = ! empty($parts['id']) ? $parts['id'] : $venue_id;
103
-        }
104
-
105
-        return apply_filters(
106
-            'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args',
107
-            $args,
108
-            $input
109
-        );
110
-    }
111
-
112
-
113
-    /**
114
-     * Sets the venue for the event.
115
-     *
116
-     * @param EE_Event $entity The event instance.
117
-     * @param int      $venue  The venue ID
118
-     * @throws EE_Error
119
-     * @throws InvalidDataTypeException
120
-     * @throws InvalidInterfaceException
121
-     * @throws InvalidArgumentException
122
-     * @throws ReflectionException
123
-     */
124
-    public static function setEventVenue(EE_Event $entity, int $venue)
125
-    {
126
-        if (empty($venue)) {
127
-            $entity->remove_venue($venue);
128
-        } else {
129
-            $entity->add_venue($venue);
130
-        }
131
-    }
23
+	/**
24
+	 * Maps the GraphQL input to a format that the model functions can use
25
+	 *
26
+	 * @param array  $input         Data coming from the GraphQL mutation query input
27
+	 * @return array
28
+	 * @throws Exception
29
+	 */
30
+	public static function prepareFields(array $input): array
31
+	{
32
+		$args = [];
33
+
34
+		if (array_key_exists('allowDonations', $input)) {
35
+			$args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN);
36
+		}
37
+
38
+		if (array_key_exists('allowOverflow', $input)) {
39
+			$args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
40
+		}
41
+
42
+		if (array_key_exists('altRegPage', $input)) {
43
+			$args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
44
+		}
45
+
46
+		if (! empty($input['defaultRegStatus'])) {
47
+			$args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
48
+		}
49
+
50
+		if (! empty($input['description'])) {
51
+			$args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db');
52
+		}
53
+
54
+		if (array_key_exists('displayDescription', $input)) {
55
+			$args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN);
56
+		}
57
+
58
+		if (array_key_exists('displayTicketSelector', $input)) {
59
+			$args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
60
+		}
61
+
62
+		if (! empty($input['maxRegistrations'])) {
63
+			$args['EVT_additional_limit'] = absint($input['maxRegistrations']);
64
+		}
65
+
66
+		if (array_key_exists('memberOnly', $input)) {
67
+			$args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
68
+		}
69
+
70
+		if (! empty($input['name'])) {
71
+			$args['EVT_name'] = sanitize_text_field($input['name']);
72
+		}
73
+
74
+		if (array_key_exists('order', $input)) {
75
+			$args['EVT_order'] = absint($input['order']);
76
+		}
77
+
78
+		if (array_key_exists('phoneNumber', $input)) {
79
+			$args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
80
+		}
81
+
82
+		if (array_key_exists('shortDescription', $input)) {
83
+			$args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db');
84
+		}
85
+
86
+		if (array_key_exists('timezoneString', $input)) {
87
+			$args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
88
+		}
89
+
90
+		if (! empty($input['visibleOn'])) {
91
+			$args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn']));
92
+		}
93
+
94
+		if (! empty($input['manager'])) {
95
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
96
+			$args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
97
+		}
98
+
99
+		if (array_key_exists('venue', $input)) {
100
+			$venue_id = sanitize_text_field($input['venue']);
101
+			$parts = Relay::fromGlobalId($venue_id);
102
+			$args['venue'] = ! empty($parts['id']) ? $parts['id'] : $venue_id;
103
+		}
104
+
105
+		return apply_filters(
106
+			'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args',
107
+			$args,
108
+			$input
109
+		);
110
+	}
111
+
112
+
113
+	/**
114
+	 * Sets the venue for the event.
115
+	 *
116
+	 * @param EE_Event $entity The event instance.
117
+	 * @param int      $venue  The venue ID
118
+	 * @throws EE_Error
119
+	 * @throws InvalidDataTypeException
120
+	 * @throws InvalidInterfaceException
121
+	 * @throws InvalidArgumentException
122
+	 * @throws ReflectionException
123
+	 */
124
+	public static function setEventVenue(EE_Event $entity, int $venue)
125
+	{
126
+		if (empty($venue)) {
127
+			$entity->remove_venue($venue);
128
+		} else {
129
+			$entity->add_venue($venue);
130
+		}
131
+	}
132 132
 }
Please login to merge, or discard this patch.