Completed
Branch fix-dummy-related-question-qst... (e5efcf)
by
unknown
07:49 queued 03:45
created
admin_pages/other_services/Other_Services_Admin_Page.core.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         wp_register_style(
92 92
             'ee-other-services-css',
93
-            EE_OTHER_SERVICES_ASSETS_URL . 'other-services.css',
93
+            EE_OTHER_SERVICES_ASSETS_URL.'other-services.css',
94 94
             array('ee-admin-css'),
95 95
             EVENT_ESPRESSO_VERSION
96 96
         );
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     protected function _other_services()
102 102
     {
103 103
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
104
-            EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH . 'other_services_content.template.php',
104
+            EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH.'other_services_content.template.php',
105 105
             array(),
106 106
             true
107 107
         );
Please login to merge, or discard this patch.
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -15,94 +15,94 @@
 block discarded – undo
15 15
  */
16 16
 class Other_Services_Admin_Page extends EE_Admin_Page
17 17
 {
18
-    protected function _init_page_props()
19
-    {
20
-        $this->page_slug = EE_OTHER_SERVICES_PG_SLUG;
21
-        $this->page_label = esc_html__('Extensions & Services', 'event_espresso');
22
-        $this->_admin_base_url = EE_OTHER_SERVICES_ADMIN_URL;
23
-        $this->_admin_base_path = EE_OTHER_SERVICES_ADMIN;
24
-    }
25
-
26
-
27
-    protected function _ajax_hooks()
28
-    {
29
-        // todo: all hooks for ajax goes here.
30
-    }
31
-
32
-
33
-    protected function _define_page_props()
34
-    {
35
-        $this->_labels = array();
36
-        $this->_admin_page_title = $this->page_label;
37
-    }
38
-
39
-
40
-    protected function _set_page_routes()
41
-    {
42
-        $this->_page_routes = array(
43
-            'default' => array(
44
-                'func'       => '_other_services',
45
-                'capability' => 'ee_read_ee',
46
-            ),
47
-        );
48
-    }
49
-
50
-
51
-    protected function _set_page_config()
52
-    {
53
-        $this->_page_config = array(
54
-            'default' => array(
55
-                'nav'           => array(
56
-                    'label' => esc_html__('Other Available Services', 'event_espresso'),
57
-                    'order' => 10,
58
-                ),
59
-                'require_nonce' => false,
60
-            ),
61
-        );
62
-    }
63
-
64
-
65
-    // none of the below group are currently used for Support pages
66
-    protected function _add_screen_options()
67
-    {
68
-    }
69
-
70
-    protected function _add_feature_pointers()
71
-    {
72
-    }
73
-
74
-    public function admin_init()
75
-    {
76
-    }
77
-
78
-    public function admin_notices()
79
-    {
80
-    }
81
-
82
-    public function admin_footer_scripts()
83
-    {
84
-    }
85
-
86
-
87
-    public function load_scripts_styles()
88
-    {
89
-        wp_register_style(
90
-            'ee-other-services-css',
91
-            EE_OTHER_SERVICES_ASSETS_URL . 'other-services.css',
92
-            array('ee-admin-css'),
93
-            EVENT_ESPRESSO_VERSION
94
-        );
95
-        wp_enqueue_style('ee-other-services-css');
96
-    }
97
-
98
-
99
-    protected function _other_services()
100
-    {
101
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
102
-            EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH . 'other_services_content.template.php',
103
-            array(),
104
-            true
105
-        );
106
-        $this->display_admin_page_with_no_sidebar();
107
-    }
18
+	protected function _init_page_props()
19
+	{
20
+		$this->page_slug = EE_OTHER_SERVICES_PG_SLUG;
21
+		$this->page_label = esc_html__('Extensions & Services', 'event_espresso');
22
+		$this->_admin_base_url = EE_OTHER_SERVICES_ADMIN_URL;
23
+		$this->_admin_base_path = EE_OTHER_SERVICES_ADMIN;
24
+	}
25
+
26
+
27
+	protected function _ajax_hooks()
28
+	{
29
+		// todo: all hooks for ajax goes here.
30
+	}
31
+
32
+
33
+	protected function _define_page_props()
34
+	{
35
+		$this->_labels = array();
36
+		$this->_admin_page_title = $this->page_label;
37
+	}
38
+
39
+
40
+	protected function _set_page_routes()
41
+	{
42
+		$this->_page_routes = array(
43
+			'default' => array(
44
+				'func'       => '_other_services',
45
+				'capability' => 'ee_read_ee',
46
+			),
47
+		);
48
+	}
49
+
50
+
51
+	protected function _set_page_config()
52
+	{
53
+		$this->_page_config = array(
54
+			'default' => array(
55
+				'nav'           => array(
56
+					'label' => esc_html__('Other Available Services', 'event_espresso'),
57
+					'order' => 10,
58
+				),
59
+				'require_nonce' => false,
60
+			),
61
+		);
62
+	}
63
+
64
+
65
+	// none of the below group are currently used for Support pages
66
+	protected function _add_screen_options()
67
+	{
68
+	}
69
+
70
+	protected function _add_feature_pointers()
71
+	{
72
+	}
73
+
74
+	public function admin_init()
75
+	{
76
+	}
77
+
78
+	public function admin_notices()
79
+	{
80
+	}
81
+
82
+	public function admin_footer_scripts()
83
+	{
84
+	}
85
+
86
+
87
+	public function load_scripts_styles()
88
+	{
89
+		wp_register_style(
90
+			'ee-other-services-css',
91
+			EE_OTHER_SERVICES_ASSETS_URL . 'other-services.css',
92
+			array('ee-admin-css'),
93
+			EVENT_ESPRESSO_VERSION
94
+		);
95
+		wp_enqueue_style('ee-other-services-css');
96
+	}
97
+
98
+
99
+	protected function _other_services()
100
+	{
101
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
102
+			EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH . 'other_services_content.template.php',
103
+			array(),
104
+			true
105
+		);
106
+		$this->display_admin_page_with_no_sidebar();
107
+	}
108 108
 }
Please login to merge, or discard this patch.
espresso_thank_you/templates/thank-you-page-overview.template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 <div id="espresso-thank-you-page-overview-dv" class="width-100">
11 11
 
12
-    <?php if (! $revisit) : ?>
12
+    <?php if ( ! $revisit) : ?>
13 13
         <div class="ee-attention">
14 14
             <div class="extra-padding-sides">
15 15
                 <?php echo apply_filters(
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                         '<br />'
22 22
                     )
23 23
                 );
24
-                if (! empty($TXN_receipt_url)) : ?>
24
+                if ( ! empty($TXN_receipt_url)) : ?>
25 25
                     <br/>
26 26
                     <div class="jst-rght">
27 27
                         <a class="ee-button ee-roundish indented-text big-text"
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@
 block discarded – undo
13 13
         <div class="ee-attention">
14 14
             <div class="extra-padding-sides">
15 15
                 <?php echo apply_filters(
16
-                    'FHEE__thank_you_page_overview_template__order_conf_desc',
17
-                    sprintf(
18
-                        $order_conf_desc,
19
-                        '<h3 class="">',
20
-                        '</h3>',
21
-                        '<br />'
22
-                    )
23
-                );
24
-                if (! empty($TXN_receipt_url)) : ?>
16
+					'FHEE__thank_you_page_overview_template__order_conf_desc',
17
+					sprintf(
18
+						$order_conf_desc,
19
+						'<h3 class="">',
20
+						'</h3>',
21
+						'<br />'
22
+					)
23
+				);
24
+				if (! empty($TXN_receipt_url)) : ?>
25 25
                     <br/>
26 26
                     <div class="jst-rght">
27 27
                         <a class="ee-button ee-roundish indented-text big-text"
28 28
                            href="<?php echo esc_url_raw($TXN_receipt_url); ?>"><span
29 29
                                 class="ee-icon ee-icon-PDF-file-type"></span>
30 30
                             <?php
31
-                            echo apply_filters(
32
-                                'FHEE__thank_you_page_overview_template__order_conf_button_text',
33
-                                esc_html__('View Full Order Confirmation Receipt', 'event_espresso')
34
-                            );
35
-                            ?></a>
31
+							echo apply_filters(
32
+								'FHEE__thank_you_page_overview_template__order_conf_button_text',
33
+								esc_html__('View Full Order Confirmation Receipt', 'event_espresso')
34
+							);
35
+							?></a>
36 36
                     </div>
37 37
                 <?php endif; ?>
38 38
             </div>
Please login to merge, or discard this patch.
templates/thank-you-page-registration-details.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
                 <tbody>
47 47
                 <?php
48 48
             }
49
-            if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
49
+            if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
50 50
                 <tr>
51 51
                     <td width="40%">
52 52
                         <?php
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
 
13 13
 <div class="ee-registration-details-dv">
14 14
     <?php
15
-    $registrations = $transaction->registrations();
16
-    $registrations = is_array($registrations) ? $registrations : [];
17
-    $reg_count     = count($registrations);
18
-    $reg_cntr      = 0;
19
-    $event_name    = '';
20
-    $wait_list     = false;
21
-    foreach ($registrations as $registration) {
22
-        if ($registration instanceof EE_Registration) {
23
-            if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
15
+	$registrations = $transaction->registrations();
16
+	$registrations = is_array($registrations) ? $registrations : [];
17
+	$reg_count     = count($registrations);
18
+	$reg_cntr      = 0;
19
+	$event_name    = '';
20
+	$wait_list     = false;
21
+	foreach ($registrations as $registration) {
22
+		if ($registration instanceof EE_Registration) {
23
+			if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
24 24
                 </tbody>
25 25
                 </table>
26 26
                 <?php
27
-            }
28
-            $reg_cntr++;
29
-            if ($event_name != $registration->event_name()) {
30
-                ?>
27
+			}
28
+			$reg_cntr++;
29
+			if ($event_name != $registration->event_name()) {
30
+				?>
31 31
                 <h5>
32 32
                     <span class="smaller-text grey-text">
33 33
                         <?php esc_html_e('for', 'event_espresso'); ?> :
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
                 </thead>
51 51
                 <tbody>
52 52
                 <?php
53
-            }
54
-            if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
53
+			}
54
+			if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
55 55
                 <tr>
56 56
                     <td width="40%">
57 57
                         <?php
58
-                        if ($registration->attendee() instanceof EE_Attendee) {
59
-                            echo esc_html($registration->attendee()->full_name(true));
60
-                        }
61
-                        ?>
58
+						if ($registration->attendee() instanceof EE_Attendee) {
59
+							echo esc_html($registration->attendee()->full_name(true));
60
+						}
61
+						?>
62 62
                         <p class="tiny-text" style="margin: .75em 0 0;">
63 63
                             <?php
64
-                            if ($registration->count_question_groups()) {
65
-                                ?>
64
+							if ($registration->count_question_groups()) {
65
+								?>
66 66
                                 <a class="ee-icon-only-lnk"
67 67
                                    href="<?php echo esc_url_raw($registration->edit_attendee_information_url()); ?>"
68 68
                                    title="<?php esc_attr_e(
69
-                                       'Click here to edit Attendee Information',
70
-                                       'event_espresso'
71
-                                   ); ?>"
69
+									   'Click here to edit Attendee Information',
70
+									   'event_espresso'
71
+								   ); ?>"
72 72
                                 >
73 73
                                     <span class="ee-icon ee-icon-user-edit"></span>
74 74
                                     <?php esc_html_e('edit info', 'event_espresso'); ?>
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
                             <?php } ?>
77 77
                             <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk"
78 78
                                href="<?php echo add_query_arg(
79
-                                   ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'],
80
-                                   EE_Registry::instance()->CFG->core->thank_you_page_url()
81
-                               ); ?>"
79
+								   ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'],
80
+								   EE_Registry::instance()->CFG->core->thank_you_page_url()
81
+							   ); ?>"
82 82
                                title="<?php esc_attr_e(
83
-                                   'Click here to resend the Registration Confirmation email',
84
-                                   'event_espresso'
85
-                               ); ?>"
83
+								   'Click here to resend the Registration Confirmation email',
84
+								   'event_espresso'
85
+							   ); ?>"
86 86
                                rel="<?php echo esc_attr($registration->reg_url_link()); ?>"
87 87
                             >
88 88
                                 <span class="dashicons dashicons-email-alt"></span>
@@ -96,55 +96,55 @@  discard block
 block discarded – undo
96 96
                     <td width="35%" class="jst-left">
97 97
                         <?php $registration->e_pretty_status(true) ?>
98 98
                         <?php
99
-                        if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
100
-                            $wait_list = true;
101
-                        }
102
-                        ?>
99
+						if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
100
+							$wait_list = true;
101
+						}
102
+						?>
103 103
                     </td>
104 104
                 </tr>
105 105
                 <?php
106
-                do_action(
107
-                    'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
108
-                    $registration
109
-                );
110
-                $event_name = $registration->event_name();
111
-            }
112
-            if ($reg_cntr >= $reg_count) {
113
-                ?>
106
+				do_action(
107
+					'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
108
+					$registration
109
+				);
110
+				$event_name = $registration->event_name();
111
+			}
112
+			if ($reg_cntr >= $reg_count) {
113
+				?>
114 114
                 </tbody>
115 115
                 </table>
116 116
                 <?php
117
-            }
118
-        }
119
-    }
120
-    ?>
117
+			}
118
+		}
119
+	}
120
+	?>
121 121
     <?php if ($is_primary && $SPCO_attendee_information_url) { ?>
122 122
         <p class="small-text jst-rght">
123 123
             <a href='<?php echo esc_url_raw($SPCO_attendee_information_url) ?>'>
124 124
                 <?php esc_html_e(
125
-                    "Click here to edit All Attendee Information",
126
-                    'event_espresso'
127
-                ); ?>
125
+					"Click here to edit All Attendee Information",
126
+					'event_espresso'
127
+				); ?>
128 128
             </a>
129 129
         </p>
130 130
     <?php }
131
-    if ($wait_list) {
132
-        echo apply_filters(
133
-            'AFEE__thank_you_page_registration_details_template__wait_list_notice',
134
-            sprintf(
135
-                esc_html__(
136
-                    '%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
137
-                    'event_espresso'
138
-                ),
139
-                '<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
140
-                '</h6 ><p class="ee-wait-list-notice">',
141
-                '</p ><br />'
142
-            )
143
-        );
144
-    }
131
+	if ($wait_list) {
132
+		echo apply_filters(
133
+			'AFEE__thank_you_page_registration_details_template__wait_list_notice',
134
+			sprintf(
135
+				esc_html__(
136
+					'%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
137
+					'event_espresso'
138
+				),
139
+				'<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
140
+				'</h6 ><p class="ee-wait-list-notice">',
141
+				'</p ><br />'
142
+			)
143
+		);
144
+	}
145 145
 
146
-    do_action('AHEE__thank_you_page_registration_details_template__after_registration_details');
147
-    ?>
146
+	do_action('AHEE__thank_you_page_registration_details_template__after_registration_details');
147
+	?>
148 148
 
149 149
 </div>
150 150
 <!-- end of .registration-details -->
Please login to merge, or discard this patch.
espresso_thank_you/templates/thank-you-page-payment-details.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 <div id="espresso-thank-you-page-payment-details-dv">
7 7
     <?php
8
-    if (! empty($payments)) { ?>
8
+    if ( ! empty($payments)) { ?>
9 9
         <table class="ee-table">
10 10
             <thead>
11 11
             <tr>
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 <div id="espresso-thank-you-page-payment-details-dv">
19 19
     <?php
20
-    if (! empty($payments)) { ?>
20
+	if (! empty($payments)) { ?>
21 21
         <table class="ee-table">
22 22
             <thead>
23 23
             <tr>
@@ -37,39 +37,39 @@  discard block
 block discarded – undo
37 37
             </thead>
38 38
             <tbody>
39 39
             <?php
40
-            foreach ($payments as $payment) {
41
-                echo wp_kses($payment, AllowedTags::getAllowedTags());
42
-            }
43
-            ?>
40
+			foreach ($payments as $payment) {
41
+				echo wp_kses($payment, AllowedTags::getAllowedTags());
42
+			}
43
+			?>
44 44
             </tbody>
45 45
         </table>
46 46
         <?php
47
-    } else {
48
-        if ($transaction->total()) {
49
-            echo apply_filters(
50
-                'FHEE__payment_overview_template__no_payments_made',
51
-                sprintf(
52
-                    esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
53
-                    '<p class="important-notice">',
54
-                    '</p>'
55
-                )
56
-            );
57
-            do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
58
-        } else {
59
-            echo apply_filters(
60
-                'FHEE__payment_overview_template__no_payment_required',
61
-                sprintf(
62
-                    esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'),
63
-                    '<p>',
64
-                    '</p>'
65
-                )
66
-            );
67
-            do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
68
-        }
69
-    }
70
-    echo wp_kses($gateway_content, AllowedTags::getAllowedTags());
71
-    do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
72
-    ?>
47
+	} else {
48
+		if ($transaction->total()) {
49
+			echo apply_filters(
50
+				'FHEE__payment_overview_template__no_payments_made',
51
+				sprintf(
52
+					esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
53
+					'<p class="important-notice">',
54
+					'</p>'
55
+				)
56
+			);
57
+			do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
58
+		} else {
59
+			echo apply_filters(
60
+				'FHEE__payment_overview_template__no_payment_required',
61
+				sprintf(
62
+					esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'),
63
+					'<p>',
64
+					'</p>'
65
+				)
66
+			);
67
+			do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
68
+		}
69
+	}
70
+	echo wp_kses($gateway_content, AllowedTags::getAllowedTags());
71
+	do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
72
+	?>
73 73
 
74 74
     <br/>
75 75
     <?php do_action('AHEE__thank_you_page_payment_details_template__after_payment_details'); ?>
Please login to merge, or discard this patch.
core/services/commands/CommandFactoryInterface.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
 interface CommandFactoryInterface
10 10
 {
11 11
 
12
-    /**
13
-     * @param string $command_fqcn
14
-     * @param array  $arguments
15
-     * @return mixed
16
-     * @throws InvalidArgumentException
17
-     * @throws InvalidDataTypeException
18
-     * @throws InvalidInterfaceException
19
-     */
20
-    public function getNew($command_fqcn, $arguments = array());
12
+	/**
13
+	 * @param string $command_fqcn
14
+	 * @param array  $arguments
15
+	 * @return mixed
16
+	 * @throws InvalidArgumentException
17
+	 * @throws InvalidDataTypeException
18
+	 * @throws InvalidInterfaceException
19
+	 */
20
+	public function getNew($command_fqcn, $arguments = array());
21 21
 }
Please login to merge, or discard this patch.
core/services/shortcodes/ShortcodeInterface.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -4,50 +4,50 @@
 block discarded – undo
4 4
 interface ShortcodeInterface
5 5
 {
6 6
 
7
-    /**
8
-     * the actual shortcode tag that gets registered with WordPress
9
-     *
10
-     * @return string
11
-     */
12
-    public function getTag();
13
-
14
-    /**
15
-     * the length of time in seconds to cache the results of the processShortcode() method
16
-     * 0 means the processShortcode() results will NOT be cached at all
17
-     *
18
-     * @return int
19
-     */
20
-    public function cacheExpiration();
21
-
22
-    /**
23
-     * a place for adding any initialization code that needs to run prior to wp_header().
24
-     * this may be required for shortcodes that utilize a corresponding module,
25
-     * and need to enqueue assets for that module
26
-     *
27
-     * !!! IMPORTANT !!!
28
-     * After performing any logic within this method required for initialization
29
-     *         $this->shortcodeHasBeenInitialized();
30
-     * should be called to ensure that the shortcode is setup correctly.
31
-     *
32
-     * @return void
33
-     */
34
-    public function initializeShortcode();
35
-
36
-    /**
37
-     * callback that runs when the shortcode is encountered in post content.
38
-     * IMPORTANT !!!
39
-     * remember that shortcode content should be RETURNED and NOT echoed out
40
-     *
41
-     * @param array $attributes
42
-     * @return string
43
-     */
44
-    public function processShortcode($attributes = array());
45
-
46
-
47
-
48
-    /**
49
-     * Returns whether or not this shortcode class has already been initialized
50
-     * @return boolean
51
-     */
52
-    public function initialized();
7
+	/**
8
+	 * the actual shortcode tag that gets registered with WordPress
9
+	 *
10
+	 * @return string
11
+	 */
12
+	public function getTag();
13
+
14
+	/**
15
+	 * the length of time in seconds to cache the results of the processShortcode() method
16
+	 * 0 means the processShortcode() results will NOT be cached at all
17
+	 *
18
+	 * @return int
19
+	 */
20
+	public function cacheExpiration();
21
+
22
+	/**
23
+	 * a place for adding any initialization code that needs to run prior to wp_header().
24
+	 * this may be required for shortcodes that utilize a corresponding module,
25
+	 * and need to enqueue assets for that module
26
+	 *
27
+	 * !!! IMPORTANT !!!
28
+	 * After performing any logic within this method required for initialization
29
+	 *         $this->shortcodeHasBeenInitialized();
30
+	 * should be called to ensure that the shortcode is setup correctly.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function initializeShortcode();
35
+
36
+	/**
37
+	 * callback that runs when the shortcode is encountered in post content.
38
+	 * IMPORTANT !!!
39
+	 * remember that shortcode content should be RETURNED and NOT echoed out
40
+	 *
41
+	 * @param array $attributes
42
+	 * @return string
43
+	 */
44
+	public function processShortcode($attributes = array());
45
+
46
+
47
+
48
+	/**
49
+	 * Returns whether or not this shortcode class has already been initialized
50
+	 * @return boolean
51
+	 */
52
+	public function initialized();
53 53
 }
Please login to merge, or discard this patch.
core/services/shortcodes/EspressoShortcode.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             // serialized attributes
105 105
             wp_json_encode($attributes),
106 106
             // Closure for generating content if cache is expired
107
-            function () use ($shortcode, $attributes) {
107
+            function() use ($shortcode, $attributes) {
108 108
                 if ($shortcode->initialized() === false) {
109 109
                     $shortcode->initializeShortcode();
110 110
                 }
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
         $custom_sanitization = $this->customAttributeSanitizationMap();
192 192
         foreach ($attributes as $key => $value) {
193 193
             // is a custom sanitization callback specified ?
194
-            if (isset($custom_sanitization[ $key ])) {
195
-                $callback = $custom_sanitization[ $key ];
194
+            if (isset($custom_sanitization[$key])) {
195
+                $callback = $custom_sanitization[$key];
196 196
                 if ($callback === 'skip_sanitization') {
197
-                    $attributes[ $key ] = $value;
197
+                    $attributes[$key] = $value;
198 198
                     continue;
199 199
                 }
200 200
                 if (function_exists($callback)) {
201
-                    $attributes[ $key ] = $callback($value);
201
+                    $attributes[$key] = $callback($value);
202 202
                     continue;
203 203
                 }
204 204
             }
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
                 case is_float($value):
209 209
                     // typical booleans
210 210
                 case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true):
211
-                    $attributes[ $key ] = $value;
211
+                    $attributes[$key] = $value;
212 212
                     break;
213 213
                 case is_string($value):
214
-                    $attributes[ $key ] = sanitize_text_field($value);
214
+                    $attributes[$key] = sanitize_text_field($value);
215 215
                     break;
216 216
                 case is_array($value):
217
-                    $attributes[ $key ] = $this->sanitizeAttributes($value);
217
+                    $attributes[$key] = $this->sanitizeAttributes($value);
218 218
                     break;
219 219
                 default:
220 220
                     // only remaining data types are Object and Resource
221 221
                     // which are not allowed as shortcode attributes
222
-                    $attributes[ $key ] = null;
222
+                    $attributes[$key] = null;
223 223
                     break;
224 224
             }
225 225
         }
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -19,223 +19,223 @@
 block discarded – undo
19 19
  */
20 20
 abstract class EspressoShortcode implements ShortcodeInterface
21 21
 {
22
-    /**
23
-     * transient prefix
24
-     *
25
-     * @type string
26
-     */
27
-    const CACHE_TRANSIENT_PREFIX = 'ee_sc_';
28
-
29
-    /**
30
-     * @var PostRelatedCacheManager $cache_manager
31
-     */
32
-    private $cache_manager;
33
-
34
-    /**
35
-     * true if ShortcodeInterface::initializeShortcode() has been called
36
-     * if false, then that will get called before processing
37
-     *
38
-     * @var boolean $initialized
39
-     */
40
-    private $initialized = false;
41
-
42
-
43
-    /**
44
-     * EspressoShortcode constructor
45
-     *
46
-     * @param PostRelatedCacheManager $cache_manager
47
-     */
48
-    public function __construct(PostRelatedCacheManager $cache_manager)
49
-    {
50
-        $this->cache_manager = $cache_manager;
51
-    }
52
-
53
-
54
-    /**
55
-     * @return void
56
-     */
57
-    public function shortcodeHasBeenInitialized()
58
-    {
59
-        $this->initialized = true;
60
-    }
61
-
62
-
63
-    /**
64
-     * enqueues scripts then processes the shortcode
65
-     *
66
-     * @param array $attributes
67
-     * @return string
68
-     * @throws EE_Error
69
-     * @throws ReflectionException
70
-     */
71
-    final public function processShortcodeCallback($attributes = array())
72
-    {
73
-        if ($this instanceof EnqueueAssetsInterface) {
74
-            if (is_admin()) {
75
-                $this->enqueueAdminScripts();
76
-            } else {
77
-                $this->enqueueScripts();
78
-            }
79
-        }
80
-        return $this->shortcodeContent(
81
-            $this->sanitizeAttributes((array) $attributes)
82
-        );
83
-    }
84
-
85
-
86
-    /**
87
-     * If shortcode caching is enabled for the shortcode,
88
-     * and cached results exist, then that will be returned
89
-     * else new content will be generated.
90
-     * If caching is enabled, then the new content will be cached for later.
91
-     *
92
-     * @param array $attributes
93
-     * @return mixed|string
94
-     * @throws EE_Error
95
-     * @throws ReflectionException
96
-     */
97
-    private function shortcodeContent(array $attributes)
98
-    {
99
-        $shortcode = $this;
100
-        $post_ID = $this->currentPostID();
101
-        // something like "SC_EVENTS-123"
102
-        $cache_ID = $this->shortcodeCacheID($post_ID);
103
-        $this->cache_manager->clearPostRelatedCacheOnUpdate($post_ID, $cache_ID);
104
-        return $this->cache_manager->get(
105
-            $cache_ID,
106
-            // serialized attributes
107
-            wp_json_encode($attributes),
108
-            // Closure for generating content if cache is expired
109
-            function () use ($shortcode, $attributes) {
110
-                if ($shortcode->initialized() === false) {
111
-                    $shortcode->initializeShortcode();
112
-                }
113
-                return $shortcode->processShortcode($attributes);
114
-            },
115
-            // filterable cache expiration set by each shortcode
116
-            apply_filters(
117
-                'FHEE__EventEspresso_core_services_shortcodes_EspressoShortcode__shortcodeContent__cache_expiration',
118
-                $this->cacheExpiration(),
119
-                $this->getTag(),
120
-                $this
121
-            )
122
-        );
123
-    }
124
-
125
-
126
-    /**
127
-     * @return int
128
-     * @throws EE_Error
129
-     * @throws ReflectionException
130
-     */
131
-    private function currentPostID()
132
-    {
133
-        // try to get EE_Event any way we can
134
-        $event = EEH_Event_View::get_event();
135
-        // then get some kind of ID
136
-        if ($event instanceof EE_Event) {
137
-            return $event->ID();
138
-        }
139
-        global $post;
140
-        if ($post instanceof WP_Post) {
141
-            return $post->ID;
142
-        }
143
-        return 0;
144
-    }
145
-
146
-
147
-    /**
148
-     * @param int $post_ID
149
-     * @return string
150
-     */
151
-    private function shortcodeCacheID($post_ID)
152
-    {
153
-        $tag = str_replace('ESPRESSO_', '', $this->getTag());
154
-        return "SC_{$tag}-{$post_ID}";
155
-    }
156
-
157
-
158
-    /**
159
-     * array for defining custom attribute sanitization callbacks,
160
-     * where keys match keys in your attributes array,
161
-     * and values represent the sanitization function you wish to be applied to that attribute.
162
-     * So for example, if you had an integer attribute named "event_id"
163
-     * that you wanted to be sanitized using absint(),
164
-     * then you would return the following:
165
-     *      array('event_id' => 'absint')
166
-     * Entering 'skip_sanitization' for the callback value
167
-     * means that no sanitization will be applied
168
-     * on the assumption that the attribute
169
-     * will be sanitized at some point... right?
170
-     * You wouldn't pass around unsanitized attributes would you?
171
-     * That would be very Tom Foolery of you!!!
172
-     *
173
-     * @return array
174
-     */
175
-    protected function customAttributeSanitizationMap()
176
-    {
177
-        return array();
178
-    }
179
-
180
-
181
-    /**
182
-     * Performs basic sanitization on shortcode attributes
183
-     * Since incoming attributes from the shortcode usage in the WP editor will all be strings,
184
-     * most attributes will by default be sanitized using the sanitize_text_field() function.
185
-     * This can be overridden using the customAttributeSanitizationMap() method (see above),
186
-     * all other attributes would be sanitized using the defaults in the switch statement below
187
-     *
188
-     * @param array $attributes
189
-     * @return array
190
-     */
191
-    private function sanitizeAttributes(array $attributes)
192
-    {
193
-        $custom_sanitization = $this->customAttributeSanitizationMap();
194
-        foreach ($attributes as $key => $value) {
195
-            // is a custom sanitization callback specified ?
196
-            if (isset($custom_sanitization[ $key ])) {
197
-                $callback = $custom_sanitization[ $key ];
198
-                if ($callback === 'skip_sanitization') {
199
-                    $attributes[ $key ] = $value;
200
-                    continue;
201
-                }
202
-                if (function_exists($callback)) {
203
-                    $attributes[ $key ] = $callback($value);
204
-                    continue;
205
-                }
206
-            }
207
-            switch (true) {
208
-                case $value === null:
209
-                case is_int($value):
210
-                case is_float($value):
211
-                    // typical booleans
212
-                case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true):
213
-                    $attributes[ $key ] = $value;
214
-                    break;
215
-                case is_string($value):
216
-                    $attributes[ $key ] = sanitize_text_field($value);
217
-                    break;
218
-                case is_array($value):
219
-                    $attributes[ $key ] = $this->sanitizeAttributes($value);
220
-                    break;
221
-                default:
222
-                    // only remaining data types are Object and Resource
223
-                    // which are not allowed as shortcode attributes
224
-                    $attributes[ $key ] = null;
225
-                    break;
226
-            }
227
-        }
228
-        return $attributes;
229
-    }
230
-
231
-
232
-    /**
233
-     * Returns whether or not this shortcode has been initialized
234
-     *
235
-     * @return boolean
236
-     */
237
-    public function initialized()
238
-    {
239
-        return $this->initialized;
240
-    }
22
+	/**
23
+	 * transient prefix
24
+	 *
25
+	 * @type string
26
+	 */
27
+	const CACHE_TRANSIENT_PREFIX = 'ee_sc_';
28
+
29
+	/**
30
+	 * @var PostRelatedCacheManager $cache_manager
31
+	 */
32
+	private $cache_manager;
33
+
34
+	/**
35
+	 * true if ShortcodeInterface::initializeShortcode() has been called
36
+	 * if false, then that will get called before processing
37
+	 *
38
+	 * @var boolean $initialized
39
+	 */
40
+	private $initialized = false;
41
+
42
+
43
+	/**
44
+	 * EspressoShortcode constructor
45
+	 *
46
+	 * @param PostRelatedCacheManager $cache_manager
47
+	 */
48
+	public function __construct(PostRelatedCacheManager $cache_manager)
49
+	{
50
+		$this->cache_manager = $cache_manager;
51
+	}
52
+
53
+
54
+	/**
55
+	 * @return void
56
+	 */
57
+	public function shortcodeHasBeenInitialized()
58
+	{
59
+		$this->initialized = true;
60
+	}
61
+
62
+
63
+	/**
64
+	 * enqueues scripts then processes the shortcode
65
+	 *
66
+	 * @param array $attributes
67
+	 * @return string
68
+	 * @throws EE_Error
69
+	 * @throws ReflectionException
70
+	 */
71
+	final public function processShortcodeCallback($attributes = array())
72
+	{
73
+		if ($this instanceof EnqueueAssetsInterface) {
74
+			if (is_admin()) {
75
+				$this->enqueueAdminScripts();
76
+			} else {
77
+				$this->enqueueScripts();
78
+			}
79
+		}
80
+		return $this->shortcodeContent(
81
+			$this->sanitizeAttributes((array) $attributes)
82
+		);
83
+	}
84
+
85
+
86
+	/**
87
+	 * If shortcode caching is enabled for the shortcode,
88
+	 * and cached results exist, then that will be returned
89
+	 * else new content will be generated.
90
+	 * If caching is enabled, then the new content will be cached for later.
91
+	 *
92
+	 * @param array $attributes
93
+	 * @return mixed|string
94
+	 * @throws EE_Error
95
+	 * @throws ReflectionException
96
+	 */
97
+	private function shortcodeContent(array $attributes)
98
+	{
99
+		$shortcode = $this;
100
+		$post_ID = $this->currentPostID();
101
+		// something like "SC_EVENTS-123"
102
+		$cache_ID = $this->shortcodeCacheID($post_ID);
103
+		$this->cache_manager->clearPostRelatedCacheOnUpdate($post_ID, $cache_ID);
104
+		return $this->cache_manager->get(
105
+			$cache_ID,
106
+			// serialized attributes
107
+			wp_json_encode($attributes),
108
+			// Closure for generating content if cache is expired
109
+			function () use ($shortcode, $attributes) {
110
+				if ($shortcode->initialized() === false) {
111
+					$shortcode->initializeShortcode();
112
+				}
113
+				return $shortcode->processShortcode($attributes);
114
+			},
115
+			// filterable cache expiration set by each shortcode
116
+			apply_filters(
117
+				'FHEE__EventEspresso_core_services_shortcodes_EspressoShortcode__shortcodeContent__cache_expiration',
118
+				$this->cacheExpiration(),
119
+				$this->getTag(),
120
+				$this
121
+			)
122
+		);
123
+	}
124
+
125
+
126
+	/**
127
+	 * @return int
128
+	 * @throws EE_Error
129
+	 * @throws ReflectionException
130
+	 */
131
+	private function currentPostID()
132
+	{
133
+		// try to get EE_Event any way we can
134
+		$event = EEH_Event_View::get_event();
135
+		// then get some kind of ID
136
+		if ($event instanceof EE_Event) {
137
+			return $event->ID();
138
+		}
139
+		global $post;
140
+		if ($post instanceof WP_Post) {
141
+			return $post->ID;
142
+		}
143
+		return 0;
144
+	}
145
+
146
+
147
+	/**
148
+	 * @param int $post_ID
149
+	 * @return string
150
+	 */
151
+	private function shortcodeCacheID($post_ID)
152
+	{
153
+		$tag = str_replace('ESPRESSO_', '', $this->getTag());
154
+		return "SC_{$tag}-{$post_ID}";
155
+	}
156
+
157
+
158
+	/**
159
+	 * array for defining custom attribute sanitization callbacks,
160
+	 * where keys match keys in your attributes array,
161
+	 * and values represent the sanitization function you wish to be applied to that attribute.
162
+	 * So for example, if you had an integer attribute named "event_id"
163
+	 * that you wanted to be sanitized using absint(),
164
+	 * then you would return the following:
165
+	 *      array('event_id' => 'absint')
166
+	 * Entering 'skip_sanitization' for the callback value
167
+	 * means that no sanitization will be applied
168
+	 * on the assumption that the attribute
169
+	 * will be sanitized at some point... right?
170
+	 * You wouldn't pass around unsanitized attributes would you?
171
+	 * That would be very Tom Foolery of you!!!
172
+	 *
173
+	 * @return array
174
+	 */
175
+	protected function customAttributeSanitizationMap()
176
+	{
177
+		return array();
178
+	}
179
+
180
+
181
+	/**
182
+	 * Performs basic sanitization on shortcode attributes
183
+	 * Since incoming attributes from the shortcode usage in the WP editor will all be strings,
184
+	 * most attributes will by default be sanitized using the sanitize_text_field() function.
185
+	 * This can be overridden using the customAttributeSanitizationMap() method (see above),
186
+	 * all other attributes would be sanitized using the defaults in the switch statement below
187
+	 *
188
+	 * @param array $attributes
189
+	 * @return array
190
+	 */
191
+	private function sanitizeAttributes(array $attributes)
192
+	{
193
+		$custom_sanitization = $this->customAttributeSanitizationMap();
194
+		foreach ($attributes as $key => $value) {
195
+			// is a custom sanitization callback specified ?
196
+			if (isset($custom_sanitization[ $key ])) {
197
+				$callback = $custom_sanitization[ $key ];
198
+				if ($callback === 'skip_sanitization') {
199
+					$attributes[ $key ] = $value;
200
+					continue;
201
+				}
202
+				if (function_exists($callback)) {
203
+					$attributes[ $key ] = $callback($value);
204
+					continue;
205
+				}
206
+			}
207
+			switch (true) {
208
+				case $value === null:
209
+				case is_int($value):
210
+				case is_float($value):
211
+					// typical booleans
212
+				case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true):
213
+					$attributes[ $key ] = $value;
214
+					break;
215
+				case is_string($value):
216
+					$attributes[ $key ] = sanitize_text_field($value);
217
+					break;
218
+				case is_array($value):
219
+					$attributes[ $key ] = $this->sanitizeAttributes($value);
220
+					break;
221
+				default:
222
+					// only remaining data types are Object and Resource
223
+					// which are not allowed as shortcode attributes
224
+					$attributes[ $key ] = null;
225
+					break;
226
+			}
227
+		}
228
+		return $attributes;
229
+	}
230
+
231
+
232
+	/**
233
+	 * Returns whether or not this shortcode has been initialized
234
+	 *
235
+	 * @return boolean
236
+	 */
237
+	public function initialized()
238
+	{
239
+		return $this->initialized;
240
+	}
241 241
 }
Please login to merge, or discard this patch.
core/services/loaders/LoaderDecoratorInterface.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@
 block discarded – undo
5 5
 interface LoaderDecoratorInterface
6 6
 {
7 7
 
8
-    /**
9
-     * @param string $fqcn
10
-     * @param array  $arguments
11
-     * @param bool   $shared
12
-     * @return mixed
13
-     */
14
-    public function load($fqcn, $arguments = array(), $shared = true);
8
+	/**
9
+	 * @param string $fqcn
10
+	 * @param array  $arguments
11
+	 * @param bool   $shared
12
+	 * @return mixed
13
+	 */
14
+	public function load($fqcn, $arguments = array(), $shared = true);
15 15
 
16 16
 
17 17
 
18
-    /**
19
-     * calls reset() on loader if method exists
20
-     */
21
-    public function reset();
18
+	/**
19
+	 * calls reset() on loader if method exists
20
+	 */
21
+	public function reset();
22 22
 }
Please login to merge, or discard this patch.
core/services/helpers/datetime/PhpCompatLessFiveSixHelper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
         // although we don't know the TZ abbreviation, we know the UTC offset
60 60
         $timezone_string = timezone_name_from_abbr(null, $gmt_offset);
61 61
         // only use this timezone_string IF it's current offset matches the given offset
62
-        if (! empty($timezone_string)) {
62
+        if ( ! empty($timezone_string)) {
63 63
             $offset = null;
64 64
             try {
65 65
                 $offset = $this->getTimezoneOffset(new DateTimeZone($timezone_string));
Please login to merge, or discard this patch.
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -18,221 +18,221 @@
 block discarded – undo
18 18
  */
19 19
 class PhpCompatLessFiveSixHelper extends AbstractHelper
20 20
 {
21
-    /**
22
-     * PhpCompatLessFiveSixHelper constructor.
23
-     *
24
-     * @throws DomainException
25
-     */
26
-    public function __construct()
27
-    {
28
-        if (PHP_VERSION_ID >= 50600) {
29
-            throw new DomainException(
30
-                sprintf(
31
-                    esc_html__(
32
-                        'The %1$s is only usable on php versions less than 5.6.  You\'ll want to use %2$s instead.',
33
-                        'event_espresso'
34
-                    ),
35
-                    __CLASS__,
36
-                    'EventEspresso\core\services\helpers\datetime\PhpCompatGreaterFiveSixHelper'
37
-                )
38
-            );
39
-        }
40
-    }
21
+	/**
22
+	 * PhpCompatLessFiveSixHelper constructor.
23
+	 *
24
+	 * @throws DomainException
25
+	 */
26
+	public function __construct()
27
+	{
28
+		if (PHP_VERSION_ID >= 50600) {
29
+			throw new DomainException(
30
+				sprintf(
31
+					esc_html__(
32
+						'The %1$s is only usable on php versions less than 5.6.  You\'ll want to use %2$s instead.',
33
+						'event_espresso'
34
+					),
35
+					__CLASS__,
36
+					'EventEspresso\core\services\helpers\datetime\PhpCompatGreaterFiveSixHelper'
37
+				)
38
+			);
39
+		}
40
+	}
41 41
 
42
-    /**
43
-     * Returns a timezone string for the provided gmt_offset.
44
-     *
45
-     * @param float|string $gmt_offset
46
-     * @return string
47
-     * @throws EE_Error
48
-     */
49
-    public function getTimezoneStringFromGmtOffset($gmt_offset = '')
50
-    {
51
-        $gmt_offset_or_timezone_string = $this->sanitizeInitialIncomingGmtOffsetForGettingTimezoneString($gmt_offset);
52
-        if (is_string($gmt_offset_or_timezone_string)) {
53
-            return $gmt_offset_or_timezone_string;
54
-        }
55
-        // well we know its a float, so let's roll with it.
56
-        $gmt_offset = $gmt_offset_or_timezone_string;
57
-        // convert GMT offset to seconds
58
-        $gmt_offset *= HOUR_IN_SECONDS;
59
-        // although we don't know the TZ abbreviation, we know the UTC offset
60
-        $timezone_string = timezone_name_from_abbr(null, $gmt_offset);
61
-        // only use this timezone_string IF it's current offset matches the given offset
62
-        if (! empty($timezone_string)) {
63
-            $offset = null;
64
-            try {
65
-                $offset = $this->getTimezoneOffset(new DateTimeZone($timezone_string));
66
-                if ($offset !== $gmt_offset) {
67
-                    $timezone_string = false;
68
-                }
69
-            } catch (Exception $e) {
70
-                $timezone_string = false;
71
-            }
72
-        }
73
-        // better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()
74
-        // ...
75
-        $timezone_string = $timezone_string !== false
76
-            ? $timezone_string
77
-            : $this->getTimezoneStringFromAbbreviationsList($gmt_offset);
78
-        return $timezone_string;
79
-    }
42
+	/**
43
+	 * Returns a timezone string for the provided gmt_offset.
44
+	 *
45
+	 * @param float|string $gmt_offset
46
+	 * @return string
47
+	 * @throws EE_Error
48
+	 */
49
+	public function getTimezoneStringFromGmtOffset($gmt_offset = '')
50
+	{
51
+		$gmt_offset_or_timezone_string = $this->sanitizeInitialIncomingGmtOffsetForGettingTimezoneString($gmt_offset);
52
+		if (is_string($gmt_offset_or_timezone_string)) {
53
+			return $gmt_offset_or_timezone_string;
54
+		}
55
+		// well we know its a float, so let's roll with it.
56
+		$gmt_offset = $gmt_offset_or_timezone_string;
57
+		// convert GMT offset to seconds
58
+		$gmt_offset *= HOUR_IN_SECONDS;
59
+		// although we don't know the TZ abbreviation, we know the UTC offset
60
+		$timezone_string = timezone_name_from_abbr(null, $gmt_offset);
61
+		// only use this timezone_string IF it's current offset matches the given offset
62
+		if (! empty($timezone_string)) {
63
+			$offset = null;
64
+			try {
65
+				$offset = $this->getTimezoneOffset(new DateTimeZone($timezone_string));
66
+				if ($offset !== $gmt_offset) {
67
+					$timezone_string = false;
68
+				}
69
+			} catch (Exception $e) {
70
+				$timezone_string = false;
71
+			}
72
+		}
73
+		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()
74
+		// ...
75
+		$timezone_string = $timezone_string !== false
76
+			? $timezone_string
77
+			: $this->getTimezoneStringFromAbbreviationsList($gmt_offset);
78
+		return $timezone_string;
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     * @param int  $gmt_offset
84
-     * @param bool $coerce If true, we attempt to coerce with our adjustment table
85
-     * @see self::adjustInvalidGmtOffset
86
-     * @return string
87
-     * @throws EE_Error
88
-     */
89
-    protected function getTimezoneStringFromAbbreviationsList($gmt_offset = 0, $coerce = true)
90
-    {
91
-        $gmt_offset = (int) $gmt_offset;
92
-        /** @var array[] $abbreviations */
93
-        $abbreviations = DateTimeZone::listAbbreviations();
94
-        foreach ($abbreviations as $abbreviation) {
95
-            foreach ($abbreviation as $timezone) {
96
-                if ((int) $timezone['offset'] === $gmt_offset && (bool) $timezone['dst'] === false) {
97
-                    try {
98
-                        $offset = $this->getTimezoneOffset(new DateTimeZone($timezone['timezone_id']));
99
-                        if ($offset !== $gmt_offset) {
100
-                            continue;
101
-                        }
102
-                        return $timezone['timezone_id'];
103
-                    } catch (Exception $e) {
104
-                        continue;
105
-                    }
106
-                }
107
-            }
108
-        }
109
-        // if $coerce is true, let's see if we can get a timezone string after the offset is adjusted
110
-        if ($coerce === true) {
111
-            $timezone_string = $this->getTimezoneStringFromAbbreviationsList(
112
-                $this->adjustInvalidGmtOffsets($gmt_offset),
113
-                false
114
-            );
115
-            if ($timezone_string) {
116
-                return $timezone_string;
117
-            }
118
-        }
119
-        throw new EE_Error(
120
-            sprintf(
121
-                esc_html__(
122
-                    'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used',
123
-                    'event_espresso'
124
-                ),
125
-                $gmt_offset / HOUR_IN_SECONDS,
126
-                '<a href="http://www.php.net/manual/en/timezones.php">',
127
-                '</a>'
128
-            )
129
-        );
130
-    }
82
+	/**
83
+	 * @param int  $gmt_offset
84
+	 * @param bool $coerce If true, we attempt to coerce with our adjustment table
85
+	 * @see self::adjustInvalidGmtOffset
86
+	 * @return string
87
+	 * @throws EE_Error
88
+	 */
89
+	protected function getTimezoneStringFromAbbreviationsList($gmt_offset = 0, $coerce = true)
90
+	{
91
+		$gmt_offset = (int) $gmt_offset;
92
+		/** @var array[] $abbreviations */
93
+		$abbreviations = DateTimeZone::listAbbreviations();
94
+		foreach ($abbreviations as $abbreviation) {
95
+			foreach ($abbreviation as $timezone) {
96
+				if ((int) $timezone['offset'] === $gmt_offset && (bool) $timezone['dst'] === false) {
97
+					try {
98
+						$offset = $this->getTimezoneOffset(new DateTimeZone($timezone['timezone_id']));
99
+						if ($offset !== $gmt_offset) {
100
+							continue;
101
+						}
102
+						return $timezone['timezone_id'];
103
+					} catch (Exception $e) {
104
+						continue;
105
+					}
106
+				}
107
+			}
108
+		}
109
+		// if $coerce is true, let's see if we can get a timezone string after the offset is adjusted
110
+		if ($coerce === true) {
111
+			$timezone_string = $this->getTimezoneStringFromAbbreviationsList(
112
+				$this->adjustInvalidGmtOffsets($gmt_offset),
113
+				false
114
+			);
115
+			if ($timezone_string) {
116
+				return $timezone_string;
117
+			}
118
+		}
119
+		throw new EE_Error(
120
+			sprintf(
121
+				esc_html__(
122
+					'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used',
123
+					'event_espresso'
124
+				),
125
+				$gmt_offset / HOUR_IN_SECONDS,
126
+				'<a href="http://www.php.net/manual/en/timezones.php">',
127
+				'</a>'
128
+			)
129
+		);
130
+	}
131 131
 
132 132
 
133
-    /**
134
-     * Depending on PHP version,
135
-     * there might not be valid current timezone strings to match these gmt_offsets in its timezone tables.
136
-     * To get around that, for these fringe timezones we bump them to a known valid offset.
137
-     * This method should ONLY be called after first verifying an timezone_string cannot be retrieved for the offset.
138
-     *
139
-     * @param int $gmt_offset
140
-     * @return int
141
-     */
142
-    public function adjustInvalidGmtOffsets($gmt_offset = 0)
143
-    {
144
-        // make sure $gmt_offset is int
145
-        $gmt_offset = (int) $gmt_offset;
146
-        switch ($gmt_offset) {
147
-            // -12
148
-            case -43200:
149
-                $gmt_offset = -39600;
150
-                break;
151
-            // -11.5
152
-            case -41400:
153
-                $gmt_offset = -39600;
154
-                break;
155
-            // -10.5
156
-            case -37800:
157
-                $gmt_offset = -39600;
158
-                break;
159
-            // -8.5
160
-            case -30600:
161
-                $gmt_offset = -28800;
162
-                break;
163
-            // -7.5
164
-            case -27000:
165
-                $gmt_offset = -25200;
166
-                break;
167
-            // -6.5
168
-            case -23400:
169
-                $gmt_offset = -21600;
170
-                break;
171
-            // -5.5
172
-            case -19800:
173
-                $gmt_offset = -18000;
174
-                break;
175
-            // -4.5
176
-            case -16200:
177
-                $gmt_offset = -14400;
178
-                break;
179
-            // -3.5
180
-            case -12600:
181
-                $gmt_offset = -10800;
182
-                break;
183
-            // -2.5
184
-            case -9000:
185
-                $gmt_offset = -7200;
186
-                break;
187
-            // -1.5
188
-            case -5400:
189
-                $gmt_offset = -3600;
190
-                break;
191
-            // -0.5
192
-            case -1800:
193
-                $gmt_offset = 0;
194
-                break;
195
-            // .5
196
-            case 1800:
197
-                $gmt_offset = 3600;
198
-                break;
199
-            // 1.5
200
-            case 5400:
201
-                $gmt_offset = 7200;
202
-                break;
203
-            // 2.5
204
-            case 9000:
205
-                $gmt_offset = 10800;
206
-                break;
207
-            // 3.5
208
-            case 12600:
209
-                $gmt_offset = 14400;
210
-                break;
211
-            // 7.5
212
-            case 27000:
213
-                $gmt_offset = 28800;
214
-                break;
215
-            // 8.5
216
-            case 30600:
217
-                $gmt_offset = 31500;
218
-                break;
219
-            // 10.5
220
-            case 37800:
221
-                $gmt_offset = 39600;
222
-                break;
223
-            // 11.5
224
-            case 41400:
225
-                $gmt_offset = 43200;
226
-                break;
227
-            // 12.75
228
-            case 45900:
229
-                $gmt_offset = 46800;
230
-                break;
231
-            // 13.75
232
-            case 49500:
233
-                $gmt_offset = 50400;
234
-                break;
235
-        }
236
-        return $gmt_offset;
237
-    }
133
+	/**
134
+	 * Depending on PHP version,
135
+	 * there might not be valid current timezone strings to match these gmt_offsets in its timezone tables.
136
+	 * To get around that, for these fringe timezones we bump them to a known valid offset.
137
+	 * This method should ONLY be called after first verifying an timezone_string cannot be retrieved for the offset.
138
+	 *
139
+	 * @param int $gmt_offset
140
+	 * @return int
141
+	 */
142
+	public function adjustInvalidGmtOffsets($gmt_offset = 0)
143
+	{
144
+		// make sure $gmt_offset is int
145
+		$gmt_offset = (int) $gmt_offset;
146
+		switch ($gmt_offset) {
147
+			// -12
148
+			case -43200:
149
+				$gmt_offset = -39600;
150
+				break;
151
+			// -11.5
152
+			case -41400:
153
+				$gmt_offset = -39600;
154
+				break;
155
+			// -10.5
156
+			case -37800:
157
+				$gmt_offset = -39600;
158
+				break;
159
+			// -8.5
160
+			case -30600:
161
+				$gmt_offset = -28800;
162
+				break;
163
+			// -7.5
164
+			case -27000:
165
+				$gmt_offset = -25200;
166
+				break;
167
+			// -6.5
168
+			case -23400:
169
+				$gmt_offset = -21600;
170
+				break;
171
+			// -5.5
172
+			case -19800:
173
+				$gmt_offset = -18000;
174
+				break;
175
+			// -4.5
176
+			case -16200:
177
+				$gmt_offset = -14400;
178
+				break;
179
+			// -3.5
180
+			case -12600:
181
+				$gmt_offset = -10800;
182
+				break;
183
+			// -2.5
184
+			case -9000:
185
+				$gmt_offset = -7200;
186
+				break;
187
+			// -1.5
188
+			case -5400:
189
+				$gmt_offset = -3600;
190
+				break;
191
+			// -0.5
192
+			case -1800:
193
+				$gmt_offset = 0;
194
+				break;
195
+			// .5
196
+			case 1800:
197
+				$gmt_offset = 3600;
198
+				break;
199
+			// 1.5
200
+			case 5400:
201
+				$gmt_offset = 7200;
202
+				break;
203
+			// 2.5
204
+			case 9000:
205
+				$gmt_offset = 10800;
206
+				break;
207
+			// 3.5
208
+			case 12600:
209
+				$gmt_offset = 14400;
210
+				break;
211
+			// 7.5
212
+			case 27000:
213
+				$gmt_offset = 28800;
214
+				break;
215
+			// 8.5
216
+			case 30600:
217
+				$gmt_offset = 31500;
218
+				break;
219
+			// 10.5
220
+			case 37800:
221
+				$gmt_offset = 39600;
222
+				break;
223
+			// 11.5
224
+			case 41400:
225
+				$gmt_offset = 43200;
226
+				break;
227
+			// 12.75
228
+			case 45900:
229
+				$gmt_offset = 46800;
230
+				break;
231
+			// 13.75
232
+			case 49500:
233
+				$gmt_offset = 50400;
234
+				break;
235
+		}
236
+		return $gmt_offset;
237
+	}
238 238
 }
Please login to merge, or discard this patch.