@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | { |
20 | 20 | wp_register_style( |
21 | 21 | 'checkbox_dropdown_selector', |
22 | - EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
22 | + EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css', |
|
23 | 23 | array('espresso_default'), |
24 | 24 | EVENT_ESPRESSO_VERSION |
25 | 25 | ); |
26 | 26 | wp_register_style( |
27 | 27 | 'espresso_default', |
28 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
28 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', |
|
29 | 29 | array('dashicons'), |
30 | 30 | EVENT_ESPRESSO_VERSION |
31 | 31 | ); |
32 | 32 | wp_enqueue_style('checkbox_dropdown_selector'); |
33 | 33 | wp_register_script( |
34 | 34 | 'checkbox_dropdown_selector', |
35 | - EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
35 | + EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js', |
|
36 | 36 | array('jquery'), |
37 | 37 | EVENT_ESPRESSO_VERSION, |
38 | 38 | true |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function iframe_css(array $iframe_css) |
73 | 73 | { |
74 | - $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
74 | + $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css'; |
|
75 | 75 | return $iframe_css; |
76 | 76 | } |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function iframe_js(array $iframe_js) |
87 | 87 | { |
88 | - $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
88 | + $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js'; |
|
89 | 89 | return $iframe_js; |
90 | 90 | } |
91 | 91 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
102 | 102 | $input->set_label_sizes(); |
103 | 103 | $label_size_class = $input->get_label_size_class(); |
104 | - if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
104 | + if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
105 | 105 | EE_Error::doing_it_wrong( |
106 | 106 | 'EE_Checkbox_Display_Strategy::display()', |
107 | 107 | sprintf( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ), |
112 | 112 | $input->html_id(), |
113 | 113 | var_export($input->raw_value(), true), |
114 | - $input->html_name() . '[]' |
|
114 | + $input->html_name().'[]' |
|
115 | 115 | ), |
116 | 116 | '4.8.1' |
117 | 117 | ); |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
122 | - $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
122 | + $html .= '<button id="'.$input->html_id().'-btn"'; |
|
123 | 123 | // $html .= ' name="' . $input->html_name() . '"'; |
124 | - $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
125 | - $html .= ' style="' . $input->html_style() . '"'; |
|
126 | - $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
127 | - $html .= ' ' . $input->other_html_attributes() . '>'; |
|
124 | + $html .= ' class="'.$input->html_class().' checkbox-dropdown-selector-btn button-secondary button"'; |
|
125 | + $html .= ' style="'.$input->html_style().'"'; |
|
126 | + $html .= ' data-target="'.$input->html_id().'-options-dv"'; |
|
127 | + $html .= ' '.$input->other_html_attributes().'>'; |
|
128 | 128 | $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
129 | 129 | $html .= $select_button_text; |
130 | 130 | $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
131 | 131 | $html .= '</button>'; |
132 | 132 | $html .= EEH_HTML::div( |
133 | 133 | '', |
134 | - $input->html_id() . '-options-dv', |
|
134 | + $input->html_id().'-options-dv', |
|
135 | 135 | 'checkbox-dropdown-selector' |
136 | 136 | ); |
137 | 137 | $html .= EEH_HTML::link( |
@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | . '">'; |
158 | 158 | $html .= EEH_HTML::nl(1, 'checkbox'); |
159 | 159 | $html .= '<input type="checkbox"'; |
160 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
161 | - $html .= ' id="' . $html_id . '"'; |
|
162 | - $html .= ' class="' . $input->html_class() . '-option"'; |
|
163 | - $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
164 | - $html .= ' value="' . esc_attr($value) . '"'; |
|
160 | + $html .= ' name="'.$input->html_name().'[]"'; |
|
161 | + $html .= ' id="'.$html_id.'"'; |
|
162 | + $html .= ' class="'.$input->html_class().'-option"'; |
|
163 | + $html .= $input->html_style() ? ' style="'.$input->html_style().'"' : ''; |
|
164 | + $html .= ' value="'.esc_attr($value).'"'; |
|
165 | 165 | $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
166 | 166 | ? ' checked="checked"' |
167 | 167 | : ''; |
168 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
168 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
169 | 169 | $html .= '>'; |
170 | - $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
171 | - $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
170 | + $html .= '<span class="datetime-selector-option-text-spn">'.$display_text.'</span>'; |
|
171 | + $html .= EEH_HTML::nl(-1, 'checkbox').'</label>'; |
|
172 | 172 | $html .= EEH_HTML::lix(); |
173 | 173 | } |
174 | 174 | $html .= EEH_HTML::ulx(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'event_espresso' |
183 | 183 | ) |
184 | 184 | ), |
185 | - $input->html_id() . '-date-time-filter-notice-pg', |
|
185 | + $input->html_id().'-date-time-filter-notice-pg', |
|
186 | 186 | 'date-time-filter-notice-pg small-text lt-grey-text' |
187 | 187 | ); |
188 | 188 | $html .= \EEH_HTML::br(); |
@@ -13,180 +13,180 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * enqueues css and js, so that this can be called statically |
|
18 | - */ |
|
19 | - public static function enqueue_styles_and_scripts() |
|
20 | - { |
|
21 | - wp_register_style( |
|
22 | - 'checkbox_dropdown_selector', |
|
23 | - EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
24 | - array('espresso_default'), |
|
25 | - EVENT_ESPRESSO_VERSION |
|
26 | - ); |
|
27 | - wp_register_style( |
|
28 | - 'espresso_default', |
|
29 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
30 | - array('dashicons'), |
|
31 | - EVENT_ESPRESSO_VERSION |
|
32 | - ); |
|
33 | - wp_enqueue_style('checkbox_dropdown_selector'); |
|
34 | - wp_register_script( |
|
35 | - 'checkbox_dropdown_selector', |
|
36 | - EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
37 | - array('jquery'), |
|
38 | - EVENT_ESPRESSO_VERSION, |
|
39 | - true |
|
40 | - ); |
|
41 | - wp_localize_script( |
|
42 | - 'ticket_selector', |
|
43 | - 'eeDTS', |
|
44 | - array( |
|
45 | - 'maxChecked' => EE_Registry::instance() |
|
46 | - ->CFG |
|
47 | - ->template_settings |
|
48 | - ->EED_Ticket_Selector |
|
49 | - ->getDatetimeSelectorMaxChecked() |
|
50 | - ) |
|
51 | - ); |
|
52 | - wp_enqueue_script('checkbox_dropdown_selector'); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
59 | - */ |
|
60 | - public function enqueue_js() |
|
61 | - { |
|
62 | - EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * callback for Iframe::addStylesheets() child class methods |
|
69 | - * |
|
70 | - * @param array $iframe_css |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function iframe_css(array $iframe_css) |
|
74 | - { |
|
75 | - $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
76 | - return $iframe_css; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * callback for Iframe::addScripts() child class methods |
|
83 | - * |
|
84 | - * @param array $iframe_js |
|
85 | - * @return array |
|
86 | - */ |
|
87 | - public function iframe_js(array $iframe_js) |
|
88 | - { |
|
89 | - $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
90 | - return $iframe_js; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @throws EE_Error |
|
96 | - * @return string of html to display the field |
|
97 | - */ |
|
98 | - public function display() |
|
99 | - { |
|
100 | - $input = $this->get_input(); |
|
101 | - $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : ''; |
|
102 | - // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
103 | - $input->set_label_sizes(); |
|
104 | - $label_size_class = $input->get_label_size_class(); |
|
105 | - if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
106 | - EE_Error::doing_it_wrong( |
|
107 | - 'EE_Checkbox_Display_Strategy::display()', |
|
108 | - sprintf( |
|
109 | - esc_html__( |
|
110 | - 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', |
|
111 | - 'event_espresso' |
|
112 | - ), |
|
113 | - $input->html_id(), |
|
114 | - var_export($input->raw_value(), true), |
|
115 | - $input->html_name() . '[]' |
|
116 | - ), |
|
117 | - '4.8.1' |
|
118 | - ); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
|
123 | - $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
124 | - // $html .= ' name="' . $input->html_name() . '"'; |
|
125 | - $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
126 | - $html .= ' style="' . $input->html_style() . '"'; |
|
127 | - $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
128 | - $html .= ' ' . $input->other_html_attributes() . '>'; |
|
129 | - $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
|
130 | - $html .= $select_button_text; |
|
131 | - $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
|
132 | - $html .= '</button>'; |
|
133 | - $html .= EEH_HTML::div( |
|
134 | - '', |
|
135 | - $input->html_id() . '-options-dv', |
|
136 | - 'checkbox-dropdown-selector' |
|
137 | - ); |
|
138 | - $html .= EEH_HTML::link( |
|
139 | - '', |
|
140 | - '<span class="dashicons dashicons-no"></span>', |
|
141 | - esc_html__('close datetime selector', 'event_espresso'), |
|
142 | - '', |
|
143 | - 'close-espresso-notice' |
|
144 | - ); |
|
145 | - $html .= EEH_HTML::ul(); |
|
146 | - $input_raw_value = (array) $input->raw_value(); |
|
147 | - foreach ($input->options() as $value => $display_text) { |
|
148 | - $html .= EEH_HTML::li(); |
|
149 | - $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
150 | - $html_id = $this->get_sub_input_id($value); |
|
151 | - $html .= EEH_HTML::nl(0, 'checkbox'); |
|
152 | - $html .= '<label for="' |
|
153 | - . $html_id |
|
154 | - . '" id="' |
|
155 | - . $html_id |
|
156 | - . '-lbl" class="ee-checkbox-label-after' |
|
157 | - . $label_size_class |
|
158 | - . '">'; |
|
159 | - $html .= EEH_HTML::nl(1, 'checkbox'); |
|
160 | - $html .= '<input type="checkbox"'; |
|
161 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
162 | - $html .= ' id="' . $html_id . '"'; |
|
163 | - $html .= ' class="' . $input->html_class() . '-option"'; |
|
164 | - $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
165 | - $html .= ' value="' . esc_attr($value) . '"'; |
|
166 | - $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
|
167 | - ? ' checked="checked"' |
|
168 | - : ''; |
|
169 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
170 | - $html .= '>'; |
|
171 | - $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
172 | - $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
173 | - $html .= EEH_HTML::lix(); |
|
174 | - } |
|
175 | - $html .= EEH_HTML::ulx(); |
|
176 | - $html .= EEH_HTML::divx(); |
|
177 | - $html .= EEH_HTML::divx(); |
|
178 | - $html .= EEH_HTML::p( |
|
179 | - apply_filters( |
|
180 | - 'FHEE__EE_Checkbox_Dropdown_Selector_Display_Strategy__display__html', |
|
181 | - esc_html__( |
|
182 | - 'To view additional ticket options, click the "Filter by Date" button and select more dates.', |
|
183 | - 'event_espresso' |
|
184 | - ) |
|
185 | - ), |
|
186 | - $input->html_id() . '-date-time-filter-notice-pg', |
|
187 | - 'date-time-filter-notice-pg small-text lt-grey-text' |
|
188 | - ); |
|
189 | - $html .= \EEH_HTML::br(); |
|
190 | - return $html; |
|
191 | - } |
|
16 | + /** |
|
17 | + * enqueues css and js, so that this can be called statically |
|
18 | + */ |
|
19 | + public static function enqueue_styles_and_scripts() |
|
20 | + { |
|
21 | + wp_register_style( |
|
22 | + 'checkbox_dropdown_selector', |
|
23 | + EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
24 | + array('espresso_default'), |
|
25 | + EVENT_ESPRESSO_VERSION |
|
26 | + ); |
|
27 | + wp_register_style( |
|
28 | + 'espresso_default', |
|
29 | + EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
30 | + array('dashicons'), |
|
31 | + EVENT_ESPRESSO_VERSION |
|
32 | + ); |
|
33 | + wp_enqueue_style('checkbox_dropdown_selector'); |
|
34 | + wp_register_script( |
|
35 | + 'checkbox_dropdown_selector', |
|
36 | + EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
37 | + array('jquery'), |
|
38 | + EVENT_ESPRESSO_VERSION, |
|
39 | + true |
|
40 | + ); |
|
41 | + wp_localize_script( |
|
42 | + 'ticket_selector', |
|
43 | + 'eeDTS', |
|
44 | + array( |
|
45 | + 'maxChecked' => EE_Registry::instance() |
|
46 | + ->CFG |
|
47 | + ->template_settings |
|
48 | + ->EED_Ticket_Selector |
|
49 | + ->getDatetimeSelectorMaxChecked() |
|
50 | + ) |
|
51 | + ); |
|
52 | + wp_enqueue_script('checkbox_dropdown_selector'); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
59 | + */ |
|
60 | + public function enqueue_js() |
|
61 | + { |
|
62 | + EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * callback for Iframe::addStylesheets() child class methods |
|
69 | + * |
|
70 | + * @param array $iframe_css |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function iframe_css(array $iframe_css) |
|
74 | + { |
|
75 | + $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
76 | + return $iframe_css; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * callback for Iframe::addScripts() child class methods |
|
83 | + * |
|
84 | + * @param array $iframe_js |
|
85 | + * @return array |
|
86 | + */ |
|
87 | + public function iframe_js(array $iframe_js) |
|
88 | + { |
|
89 | + $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
90 | + return $iframe_js; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @throws EE_Error |
|
96 | + * @return string of html to display the field |
|
97 | + */ |
|
98 | + public function display() |
|
99 | + { |
|
100 | + $input = $this->get_input(); |
|
101 | + $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : ''; |
|
102 | + // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
103 | + $input->set_label_sizes(); |
|
104 | + $label_size_class = $input->get_label_size_class(); |
|
105 | + if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
106 | + EE_Error::doing_it_wrong( |
|
107 | + 'EE_Checkbox_Display_Strategy::display()', |
|
108 | + sprintf( |
|
109 | + esc_html__( |
|
110 | + 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', |
|
111 | + 'event_espresso' |
|
112 | + ), |
|
113 | + $input->html_id(), |
|
114 | + var_export($input->raw_value(), true), |
|
115 | + $input->html_name() . '[]' |
|
116 | + ), |
|
117 | + '4.8.1' |
|
118 | + ); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
|
123 | + $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
124 | + // $html .= ' name="' . $input->html_name() . '"'; |
|
125 | + $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
126 | + $html .= ' style="' . $input->html_style() . '"'; |
|
127 | + $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
128 | + $html .= ' ' . $input->other_html_attributes() . '>'; |
|
129 | + $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
|
130 | + $html .= $select_button_text; |
|
131 | + $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
|
132 | + $html .= '</button>'; |
|
133 | + $html .= EEH_HTML::div( |
|
134 | + '', |
|
135 | + $input->html_id() . '-options-dv', |
|
136 | + 'checkbox-dropdown-selector' |
|
137 | + ); |
|
138 | + $html .= EEH_HTML::link( |
|
139 | + '', |
|
140 | + '<span class="dashicons dashicons-no"></span>', |
|
141 | + esc_html__('close datetime selector', 'event_espresso'), |
|
142 | + '', |
|
143 | + 'close-espresso-notice' |
|
144 | + ); |
|
145 | + $html .= EEH_HTML::ul(); |
|
146 | + $input_raw_value = (array) $input->raw_value(); |
|
147 | + foreach ($input->options() as $value => $display_text) { |
|
148 | + $html .= EEH_HTML::li(); |
|
149 | + $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
150 | + $html_id = $this->get_sub_input_id($value); |
|
151 | + $html .= EEH_HTML::nl(0, 'checkbox'); |
|
152 | + $html .= '<label for="' |
|
153 | + . $html_id |
|
154 | + . '" id="' |
|
155 | + . $html_id |
|
156 | + . '-lbl" class="ee-checkbox-label-after' |
|
157 | + . $label_size_class |
|
158 | + . '">'; |
|
159 | + $html .= EEH_HTML::nl(1, 'checkbox'); |
|
160 | + $html .= '<input type="checkbox"'; |
|
161 | + $html .= ' name="' . $input->html_name() . '[]"'; |
|
162 | + $html .= ' id="' . $html_id . '"'; |
|
163 | + $html .= ' class="' . $input->html_class() . '-option"'; |
|
164 | + $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
165 | + $html .= ' value="' . esc_attr($value) . '"'; |
|
166 | + $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
|
167 | + ? ' checked="checked"' |
|
168 | + : ''; |
|
169 | + $html .= ' ' . $this->_input->other_html_attributes(); |
|
170 | + $html .= '>'; |
|
171 | + $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
172 | + $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
173 | + $html .= EEH_HTML::lix(); |
|
174 | + } |
|
175 | + $html .= EEH_HTML::ulx(); |
|
176 | + $html .= EEH_HTML::divx(); |
|
177 | + $html .= EEH_HTML::divx(); |
|
178 | + $html .= EEH_HTML::p( |
|
179 | + apply_filters( |
|
180 | + 'FHEE__EE_Checkbox_Dropdown_Selector_Display_Strategy__display__html', |
|
181 | + esc_html__( |
|
182 | + 'To view additional ticket options, click the "Filter by Date" button and select more dates.', |
|
183 | + 'event_espresso' |
|
184 | + ) |
|
185 | + ), |
|
186 | + $input->html_id() . '-date-time-filter-notice-pg', |
|
187 | + 'date-time-filter-notice-pg small-text lt-grey-text' |
|
188 | + ); |
|
189 | + $html .= \EEH_HTML::br(); |
|
190 | + return $html; |
|
191 | + } |
|
192 | 192 | } |
@@ -16,19 +16,19 @@ |
||
16 | 16 | abstract class AdminPageHeaderDecorator implements AdminPageHeaderDecoratorInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var RequestInterface $request |
|
21 | - */ |
|
22 | - protected $request; |
|
19 | + /** |
|
20 | + * @var RequestInterface $request |
|
21 | + */ |
|
22 | + protected $request; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * AdminPageHeader constructor. |
|
27 | - * |
|
28 | - * @param RequestInterface $request |
|
29 | - */ |
|
30 | - public function __construct(RequestInterface $request) |
|
31 | - { |
|
32 | - $this->request = $request; |
|
33 | - } |
|
25 | + /** |
|
26 | + * AdminPageHeader constructor. |
|
27 | + * |
|
28 | + * @param RequestInterface $request |
|
29 | + */ |
|
30 | + public function __construct(RequestInterface $request) |
|
31 | + { |
|
32 | + $this->request = $request; |
|
33 | + } |
|
34 | 34 | } |
@@ -21,384 +21,384 @@ |
||
21 | 21 | class QueryBuilder |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var RequestInterface $request |
|
26 | - */ |
|
27 | - protected $request; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var EEM_Registration $registration_model |
|
31 | - */ |
|
32 | - protected $registration_model; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var string $view |
|
36 | - */ |
|
37 | - protected $view; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var array $where_params |
|
41 | - */ |
|
42 | - protected $where_params; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * QueryBuilder constructor. |
|
47 | - * |
|
48 | - * @param array $extra_request_params |
|
49 | - * @param RequestInterface $request |
|
50 | - * @param EEM_Registration $registration_model |
|
51 | - */ |
|
52 | - public function __construct( |
|
53 | - array $extra_request_params, |
|
54 | - RequestInterface $request, |
|
55 | - EEM_Registration $registration_model |
|
56 | - ) { |
|
57 | - $this->request = $request; |
|
58 | - $this->registration_model = $registration_model; |
|
59 | - foreach ($extra_request_params as $key => $value) { |
|
60 | - $this->request->setRequestParam($key, $value); |
|
61 | - } |
|
62 | - $this->view = $this->request->getRequestParam('status', ''); |
|
63 | - $this->where_params = []; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * Sets up the where conditions for the registrations query. |
|
69 | - * |
|
70 | - * @param int $per_page |
|
71 | - * @param bool $count_query |
|
72 | - * @return array |
|
73 | - * @throws EE_Error |
|
74 | - * @throws InvalidArgumentException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws InvalidInterfaceException |
|
77 | - */ |
|
78 | - public function getQueryParams($per_page = 10, $count_query = false) |
|
79 | - { |
|
80 | - $query_params = [ |
|
81 | - 0 => $this->getWhereClause(), |
|
82 | - 'caps' => EEM_Registration::caps_read_admin, |
|
83 | - 'default_where_conditions' => 'this_model_only', |
|
84 | - ]; |
|
85 | - if (! $count_query) { |
|
86 | - $query_params = array_merge( |
|
87 | - $query_params, |
|
88 | - $this->getOrderbyClause(), |
|
89 | - $this->getLimitClause($per_page) |
|
90 | - ); |
|
91 | - } |
|
92 | - |
|
93 | - return $query_params; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * Sets up the where conditions for the registrations query. |
|
99 | - * |
|
100 | - * @return array |
|
101 | - * @throws EE_Error |
|
102 | - * @throws InvalidArgumentException |
|
103 | - * @throws InvalidDataTypeException |
|
104 | - * @throws InvalidInterfaceException |
|
105 | - */ |
|
106 | - protected function getWhereClause() |
|
107 | - { |
|
108 | - $this->addAttendeeIdToWhereConditions(); |
|
109 | - $this->addEventIdToWhereConditions(); |
|
110 | - $this->addCategoryIdToWhereConditions(); |
|
111 | - $this->addDatetimeIdToWhereConditions(); |
|
112 | - $this->addTicketIdToWhereConditions(); |
|
113 | - $this->addRegistrationStatusToWhereConditions(); |
|
114 | - $this->addDateToWhereConditions(); |
|
115 | - $this->addSearchToWhereConditions(); |
|
116 | - return apply_filters( |
|
117 | - 'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', |
|
118 | - $this->where_params, |
|
119 | - $this->request->requestParams() |
|
120 | - ); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * This will add ATT_ID to the provided $this->where_clause array for EE model query parameters. |
|
126 | - */ |
|
127 | - protected function addAttendeeIdToWhereConditions() |
|
128 | - { |
|
129 | - $ATT_ID = $this->request->getRequestParam('attendee_id'); |
|
130 | - $ATT_ID = $this->request->getRequestParam('ATT_ID', $ATT_ID); |
|
131 | - if ($ATT_ID) { |
|
132 | - $this->where_params['ATT_ID'] = absint($ATT_ID); |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * This will add EVT_ID to the provided $this->where_clause array for EE model query parameters. |
|
139 | - */ |
|
140 | - protected function addEventIdToWhereConditions() |
|
141 | - { |
|
142 | - $EVT_ID = $this->request->getRequestParam('event_id'); |
|
143 | - $EVT_ID = $this->request->getRequestParam('EVT_ID', $EVT_ID); |
|
144 | - if ($EVT_ID) { |
|
145 | - $this->where_params['EVT_ID'] = absint($EVT_ID); |
|
146 | - } |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * Adds category ID if it exists in the request to the where conditions for the registrations query. |
|
152 | - */ |
|
153 | - protected function addCategoryIdToWhereConditions() |
|
154 | - { |
|
155 | - $EVT_CAT = (int) $this->request->getRequestParam('EVT_CAT'); |
|
156 | - if ($EVT_CAT > 0) { |
|
157 | - $this->where_params['Event.Term_Taxonomy.term_id'] = absint($EVT_CAT); |
|
158 | - } |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
|
164 | - */ |
|
165 | - protected function addDatetimeIdToWhereConditions() |
|
166 | - { |
|
167 | - // first look for 'datetime_id' then 'DTT_ID' using first result as fallback default value |
|
168 | - $DTT_ID = $this->request->getRequestParam('datetime_id'); |
|
169 | - $DTT_ID = $this->request->getRequestParam('DTT_ID', $DTT_ID); |
|
170 | - if ($DTT_ID) { |
|
171 | - $this->where_params['Ticket.Datetime.DTT_ID'] = absint($DTT_ID); |
|
172 | - } |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - /** |
|
177 | - * Adds the ticket ID if it exists in the request to the where conditions for the registrations query. |
|
178 | - */ |
|
179 | - protected function addTicketIdToWhereConditions() |
|
180 | - { |
|
181 | - // first look for 'ticket_id' then 'TKT_ID' using first result as fallback default value |
|
182 | - $TKT_ID = $this->request->getRequestParam('ticket_id'); |
|
183 | - $TKT_ID = $this->request->getRequestParam('TKT_ID', $TKT_ID); |
|
184 | - if ($TKT_ID) { |
|
185 | - $this->where_params['TKT_ID'] = absint($TKT_ID); |
|
186 | - } |
|
187 | - } |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * Adds the correct registration status to the where conditions for the registrations query. |
|
192 | - * If filtering by registration status, then we show registrations matching that status. |
|
193 | - * If not filtering by specified status, then we show all registrations excluding incomplete registrations |
|
194 | - * UNLESS viewing trashed registrations. |
|
195 | - */ |
|
196 | - protected function addRegistrationStatusToWhereConditions() |
|
197 | - { |
|
198 | - $registration_status = $this->request->getRequestParam('_reg_status'); |
|
199 | - if ($registration_status) { |
|
200 | - $this->where_params['STS_ID'] = sanitize_text_field($registration_status); |
|
201 | - return; |
|
202 | - } |
|
203 | - // make sure we exclude incomplete registrations, but only if not trashed. |
|
204 | - if ($this->view === 'trash') { |
|
205 | - $this->where_params['REG_deleted'] = true; |
|
206 | - return; |
|
207 | - } |
|
208 | - $this->where_params['STS_ID'] = $this->view === 'incomplete' |
|
209 | - ? EEM_Registration::status_id_incomplete |
|
210 | - : ['!=', EEM_Registration::status_id_incomplete]; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * Adds any provided date restraints to the where conditions for the registrations query. |
|
216 | - * |
|
217 | - * @throws EE_Error |
|
218 | - * @throws InvalidArgumentException |
|
219 | - * @throws InvalidDataTypeException |
|
220 | - * @throws InvalidInterfaceException |
|
221 | - */ |
|
222 | - protected function addDateToWhereConditions() |
|
223 | - { |
|
224 | - if ($this->view === 'today') { |
|
225 | - $now = date('Y-m-d', current_time('timestamp')); |
|
226 | - $this->where_params['REG_date'] = [ |
|
227 | - 'BETWEEN', |
|
228 | - [ |
|
229 | - $this->registration_model->convert_datetime_for_query( |
|
230 | - 'REG_date', |
|
231 | - $now . ' 00:00:00', |
|
232 | - 'Y-m-d H:i:s' |
|
233 | - ), |
|
234 | - $this->registration_model->convert_datetime_for_query( |
|
235 | - 'REG_date', |
|
236 | - $now . ' 23:59:59', |
|
237 | - 'Y-m-d H:i:s' |
|
238 | - ), |
|
239 | - ], |
|
240 | - ]; |
|
241 | - return; |
|
242 | - } |
|
243 | - if ($this->view === 'month') { |
|
244 | - $current_year_and_month = date('Y-m', current_time('timestamp')); |
|
245 | - $days_this_month = date('t', current_time('timestamp')); |
|
246 | - $this->where_params['REG_date'] = [ |
|
247 | - 'BETWEEN', |
|
248 | - [ |
|
249 | - $this->registration_model->convert_datetime_for_query( |
|
250 | - 'REG_date', |
|
251 | - $current_year_and_month . '-01 00:00:00', |
|
252 | - 'Y-m-d H:i:s' |
|
253 | - ), |
|
254 | - $this->registration_model->convert_datetime_for_query( |
|
255 | - 'REG_date', |
|
256 | - $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
257 | - 'Y-m-d H:i:s' |
|
258 | - ), |
|
259 | - ], |
|
260 | - ]; |
|
261 | - return; |
|
262 | - } |
|
263 | - $month_range = $this->request->getRequestParam('month_range'); |
|
264 | - if ($month_range) { |
|
265 | - $month_range = sanitize_text_field($month_range); |
|
266 | - $pieces = explode(' ', $month_range, 3); |
|
267 | - $month_requested = ! empty($pieces[0]) |
|
268 | - ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) |
|
269 | - : ''; |
|
270 | - $year_requested = ! empty($pieces[1]) |
|
271 | - ? $pieces[1] |
|
272 | - : ''; |
|
273 | - // if there is not a month or year then we can't go further |
|
274 | - if ($month_requested && $year_requested) { |
|
275 | - $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
276 | - $this->where_params['REG_date'] = [ |
|
277 | - 'BETWEEN', |
|
278 | - [ |
|
279 | - $this->registration_model->convert_datetime_for_query( |
|
280 | - 'REG_date', |
|
281 | - $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
282 | - 'Y-m-d H:i:s' |
|
283 | - ), |
|
284 | - $this->registration_model->convert_datetime_for_query( |
|
285 | - 'REG_date', |
|
286 | - $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
287 | - 'Y-m-d H:i:s' |
|
288 | - ), |
|
289 | - ], |
|
290 | - ]; |
|
291 | - } |
|
292 | - } |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - /** |
|
297 | - * Adds any provided search restraints to the where conditions for the registrations query |
|
298 | - */ |
|
299 | - protected function addSearchToWhereConditions() |
|
300 | - { |
|
301 | - $search = $this->request->getRequestParam('s'); |
|
302 | - if ($search) { |
|
303 | - $search_string = '%' . sanitize_text_field($search) . '%'; |
|
304 | - $this->where_params['OR*search_conditions'] = [ |
|
305 | - 'Event.EVT_name' => ['LIKE', $search_string], |
|
306 | - 'Event.EVT_desc' => ['LIKE', $search_string], |
|
307 | - 'Event.EVT_short_desc' => ['LIKE', $search_string], |
|
308 | - 'Attendee.ATT_full_name' => ['LIKE', $search_string], |
|
309 | - 'Attendee.ATT_fname' => ['LIKE', $search_string], |
|
310 | - 'Attendee.ATT_lname' => ['LIKE', $search_string], |
|
311 | - 'Attendee.ATT_short_bio' => ['LIKE', $search_string], |
|
312 | - 'Attendee.ATT_email' => ['LIKE', $search_string], |
|
313 | - 'Attendee.ATT_address' => ['LIKE', $search_string], |
|
314 | - 'Attendee.ATT_address2' => ['LIKE', $search_string], |
|
315 | - 'Attendee.ATT_city' => ['LIKE', $search_string], |
|
316 | - 'REG_final_price' => ['LIKE', $search_string], |
|
317 | - 'REG_code' => ['LIKE', $search_string], |
|
318 | - 'REG_count' => ['LIKE', $search_string], |
|
319 | - 'REG_group_size' => ['LIKE', $search_string], |
|
320 | - 'Ticket.TKT_name' => ['LIKE', $search_string], |
|
321 | - 'Ticket.TKT_description' => ['LIKE', $search_string], |
|
322 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_string], |
|
323 | - ]; |
|
324 | - } |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * Sets up the orderby for the registrations query. |
|
330 | - * |
|
331 | - * @return array |
|
332 | - */ |
|
333 | - protected function getOrderbyClause() |
|
334 | - { |
|
335 | - $orderby_field = $this->request->getRequestParam('orderby'); |
|
336 | - $orderby_field = $orderby_field ? sanitize_text_field($orderby_field) : '_REG_date'; |
|
337 | - switch ($orderby_field) { |
|
338 | - case '_REG_ID': |
|
339 | - $orderby = ['REG_ID']; |
|
340 | - break; |
|
341 | - case '_Reg_status': |
|
342 | - $orderby = ['STS_ID']; |
|
343 | - break; |
|
344 | - case 'ATT_fname': |
|
345 | - $orderby = ['Attendee.ATT_fname', 'Attendee.ATT_lname']; |
|
346 | - break; |
|
347 | - case 'ATT_lname': |
|
348 | - $orderby = ['Attendee.ATT_lname', 'Attendee.ATT_fname']; |
|
349 | - break; |
|
350 | - case 'event_name': |
|
351 | - $orderby = ['Event.EVT_name']; |
|
352 | - break; |
|
353 | - case 'DTT_EVT_start': |
|
354 | - $orderby = ['Event.Datetime.DTT_EVT_start']; |
|
355 | - break; |
|
356 | - case '_REG_date': |
|
357 | - $orderby = ['REG_date']; |
|
358 | - break; |
|
359 | - default: |
|
360 | - $orderby = [$orderby_field]; |
|
361 | - break; |
|
362 | - } |
|
363 | - $order = $this->request->getRequestParam('order'); |
|
364 | - $order = $order ? sanitize_text_field($order) : 'DESC'; |
|
365 | - |
|
366 | - $orderby = array_combine( |
|
367 | - $orderby, |
|
368 | - array_fill(0, count($orderby), $order) |
|
369 | - ); |
|
370 | - // because there are many registrations with the same date, define |
|
371 | - // a secondary way to order them, otherwise MySQL seems to be a bit random |
|
372 | - if (empty($orderby['REG_ID'])) { |
|
373 | - $orderby['REG_ID'] = $order; |
|
374 | - } |
|
375 | - |
|
376 | - $orderby = apply_filters( |
|
377 | - 'FHEE__Registrations_Admin_Page___get_orderby_for_registrations_query', |
|
378 | - $orderby, |
|
379 | - $this->request->requestParams() |
|
380 | - ); |
|
381 | - return ['order_by' => $orderby]; |
|
382 | - } |
|
383 | - |
|
384 | - |
|
385 | - /** |
|
386 | - * Sets up the limit for the registrations query. |
|
387 | - * |
|
388 | - * @param $per_page |
|
389 | - * @return array |
|
390 | - */ |
|
391 | - protected function getLimitClause($per_page) |
|
392 | - { |
|
393 | - $current_page = $this->request->getRequestParam('paged'); |
|
394 | - $current_page = $current_page ? absint($current_page) : 1; |
|
395 | - $per_page = (int) $this->request->getRequestParam('perpage', $per_page); |
|
396 | - // -1 means return all results so get out if that's set. |
|
397 | - if ($per_page === -1) { |
|
398 | - return []; |
|
399 | - } |
|
400 | - $per_page = absint($per_page); |
|
401 | - $offset = ($current_page - 1) * $per_page; |
|
402 | - return ['limit' => [$offset, $per_page]]; |
|
403 | - } |
|
24 | + /** |
|
25 | + * @var RequestInterface $request |
|
26 | + */ |
|
27 | + protected $request; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var EEM_Registration $registration_model |
|
31 | + */ |
|
32 | + protected $registration_model; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var string $view |
|
36 | + */ |
|
37 | + protected $view; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var array $where_params |
|
41 | + */ |
|
42 | + protected $where_params; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * QueryBuilder constructor. |
|
47 | + * |
|
48 | + * @param array $extra_request_params |
|
49 | + * @param RequestInterface $request |
|
50 | + * @param EEM_Registration $registration_model |
|
51 | + */ |
|
52 | + public function __construct( |
|
53 | + array $extra_request_params, |
|
54 | + RequestInterface $request, |
|
55 | + EEM_Registration $registration_model |
|
56 | + ) { |
|
57 | + $this->request = $request; |
|
58 | + $this->registration_model = $registration_model; |
|
59 | + foreach ($extra_request_params as $key => $value) { |
|
60 | + $this->request->setRequestParam($key, $value); |
|
61 | + } |
|
62 | + $this->view = $this->request->getRequestParam('status', ''); |
|
63 | + $this->where_params = []; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * Sets up the where conditions for the registrations query. |
|
69 | + * |
|
70 | + * @param int $per_page |
|
71 | + * @param bool $count_query |
|
72 | + * @return array |
|
73 | + * @throws EE_Error |
|
74 | + * @throws InvalidArgumentException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws InvalidInterfaceException |
|
77 | + */ |
|
78 | + public function getQueryParams($per_page = 10, $count_query = false) |
|
79 | + { |
|
80 | + $query_params = [ |
|
81 | + 0 => $this->getWhereClause(), |
|
82 | + 'caps' => EEM_Registration::caps_read_admin, |
|
83 | + 'default_where_conditions' => 'this_model_only', |
|
84 | + ]; |
|
85 | + if (! $count_query) { |
|
86 | + $query_params = array_merge( |
|
87 | + $query_params, |
|
88 | + $this->getOrderbyClause(), |
|
89 | + $this->getLimitClause($per_page) |
|
90 | + ); |
|
91 | + } |
|
92 | + |
|
93 | + return $query_params; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * Sets up the where conditions for the registrations query. |
|
99 | + * |
|
100 | + * @return array |
|
101 | + * @throws EE_Error |
|
102 | + * @throws InvalidArgumentException |
|
103 | + * @throws InvalidDataTypeException |
|
104 | + * @throws InvalidInterfaceException |
|
105 | + */ |
|
106 | + protected function getWhereClause() |
|
107 | + { |
|
108 | + $this->addAttendeeIdToWhereConditions(); |
|
109 | + $this->addEventIdToWhereConditions(); |
|
110 | + $this->addCategoryIdToWhereConditions(); |
|
111 | + $this->addDatetimeIdToWhereConditions(); |
|
112 | + $this->addTicketIdToWhereConditions(); |
|
113 | + $this->addRegistrationStatusToWhereConditions(); |
|
114 | + $this->addDateToWhereConditions(); |
|
115 | + $this->addSearchToWhereConditions(); |
|
116 | + return apply_filters( |
|
117 | + 'FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query', |
|
118 | + $this->where_params, |
|
119 | + $this->request->requestParams() |
|
120 | + ); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * This will add ATT_ID to the provided $this->where_clause array for EE model query parameters. |
|
126 | + */ |
|
127 | + protected function addAttendeeIdToWhereConditions() |
|
128 | + { |
|
129 | + $ATT_ID = $this->request->getRequestParam('attendee_id'); |
|
130 | + $ATT_ID = $this->request->getRequestParam('ATT_ID', $ATT_ID); |
|
131 | + if ($ATT_ID) { |
|
132 | + $this->where_params['ATT_ID'] = absint($ATT_ID); |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * This will add EVT_ID to the provided $this->where_clause array for EE model query parameters. |
|
139 | + */ |
|
140 | + protected function addEventIdToWhereConditions() |
|
141 | + { |
|
142 | + $EVT_ID = $this->request->getRequestParam('event_id'); |
|
143 | + $EVT_ID = $this->request->getRequestParam('EVT_ID', $EVT_ID); |
|
144 | + if ($EVT_ID) { |
|
145 | + $this->where_params['EVT_ID'] = absint($EVT_ID); |
|
146 | + } |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * Adds category ID if it exists in the request to the where conditions for the registrations query. |
|
152 | + */ |
|
153 | + protected function addCategoryIdToWhereConditions() |
|
154 | + { |
|
155 | + $EVT_CAT = (int) $this->request->getRequestParam('EVT_CAT'); |
|
156 | + if ($EVT_CAT > 0) { |
|
157 | + $this->where_params['Event.Term_Taxonomy.term_id'] = absint($EVT_CAT); |
|
158 | + } |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
|
164 | + */ |
|
165 | + protected function addDatetimeIdToWhereConditions() |
|
166 | + { |
|
167 | + // first look for 'datetime_id' then 'DTT_ID' using first result as fallback default value |
|
168 | + $DTT_ID = $this->request->getRequestParam('datetime_id'); |
|
169 | + $DTT_ID = $this->request->getRequestParam('DTT_ID', $DTT_ID); |
|
170 | + if ($DTT_ID) { |
|
171 | + $this->where_params['Ticket.Datetime.DTT_ID'] = absint($DTT_ID); |
|
172 | + } |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + /** |
|
177 | + * Adds the ticket ID if it exists in the request to the where conditions for the registrations query. |
|
178 | + */ |
|
179 | + protected function addTicketIdToWhereConditions() |
|
180 | + { |
|
181 | + // first look for 'ticket_id' then 'TKT_ID' using first result as fallback default value |
|
182 | + $TKT_ID = $this->request->getRequestParam('ticket_id'); |
|
183 | + $TKT_ID = $this->request->getRequestParam('TKT_ID', $TKT_ID); |
|
184 | + if ($TKT_ID) { |
|
185 | + $this->where_params['TKT_ID'] = absint($TKT_ID); |
|
186 | + } |
|
187 | + } |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * Adds the correct registration status to the where conditions for the registrations query. |
|
192 | + * If filtering by registration status, then we show registrations matching that status. |
|
193 | + * If not filtering by specified status, then we show all registrations excluding incomplete registrations |
|
194 | + * UNLESS viewing trashed registrations. |
|
195 | + */ |
|
196 | + protected function addRegistrationStatusToWhereConditions() |
|
197 | + { |
|
198 | + $registration_status = $this->request->getRequestParam('_reg_status'); |
|
199 | + if ($registration_status) { |
|
200 | + $this->where_params['STS_ID'] = sanitize_text_field($registration_status); |
|
201 | + return; |
|
202 | + } |
|
203 | + // make sure we exclude incomplete registrations, but only if not trashed. |
|
204 | + if ($this->view === 'trash') { |
|
205 | + $this->where_params['REG_deleted'] = true; |
|
206 | + return; |
|
207 | + } |
|
208 | + $this->where_params['STS_ID'] = $this->view === 'incomplete' |
|
209 | + ? EEM_Registration::status_id_incomplete |
|
210 | + : ['!=', EEM_Registration::status_id_incomplete]; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * Adds any provided date restraints to the where conditions for the registrations query. |
|
216 | + * |
|
217 | + * @throws EE_Error |
|
218 | + * @throws InvalidArgumentException |
|
219 | + * @throws InvalidDataTypeException |
|
220 | + * @throws InvalidInterfaceException |
|
221 | + */ |
|
222 | + protected function addDateToWhereConditions() |
|
223 | + { |
|
224 | + if ($this->view === 'today') { |
|
225 | + $now = date('Y-m-d', current_time('timestamp')); |
|
226 | + $this->where_params['REG_date'] = [ |
|
227 | + 'BETWEEN', |
|
228 | + [ |
|
229 | + $this->registration_model->convert_datetime_for_query( |
|
230 | + 'REG_date', |
|
231 | + $now . ' 00:00:00', |
|
232 | + 'Y-m-d H:i:s' |
|
233 | + ), |
|
234 | + $this->registration_model->convert_datetime_for_query( |
|
235 | + 'REG_date', |
|
236 | + $now . ' 23:59:59', |
|
237 | + 'Y-m-d H:i:s' |
|
238 | + ), |
|
239 | + ], |
|
240 | + ]; |
|
241 | + return; |
|
242 | + } |
|
243 | + if ($this->view === 'month') { |
|
244 | + $current_year_and_month = date('Y-m', current_time('timestamp')); |
|
245 | + $days_this_month = date('t', current_time('timestamp')); |
|
246 | + $this->where_params['REG_date'] = [ |
|
247 | + 'BETWEEN', |
|
248 | + [ |
|
249 | + $this->registration_model->convert_datetime_for_query( |
|
250 | + 'REG_date', |
|
251 | + $current_year_and_month . '-01 00:00:00', |
|
252 | + 'Y-m-d H:i:s' |
|
253 | + ), |
|
254 | + $this->registration_model->convert_datetime_for_query( |
|
255 | + 'REG_date', |
|
256 | + $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
257 | + 'Y-m-d H:i:s' |
|
258 | + ), |
|
259 | + ], |
|
260 | + ]; |
|
261 | + return; |
|
262 | + } |
|
263 | + $month_range = $this->request->getRequestParam('month_range'); |
|
264 | + if ($month_range) { |
|
265 | + $month_range = sanitize_text_field($month_range); |
|
266 | + $pieces = explode(' ', $month_range, 3); |
|
267 | + $month_requested = ! empty($pieces[0]) |
|
268 | + ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) |
|
269 | + : ''; |
|
270 | + $year_requested = ! empty($pieces[1]) |
|
271 | + ? $pieces[1] |
|
272 | + : ''; |
|
273 | + // if there is not a month or year then we can't go further |
|
274 | + if ($month_requested && $year_requested) { |
|
275 | + $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
276 | + $this->where_params['REG_date'] = [ |
|
277 | + 'BETWEEN', |
|
278 | + [ |
|
279 | + $this->registration_model->convert_datetime_for_query( |
|
280 | + 'REG_date', |
|
281 | + $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
282 | + 'Y-m-d H:i:s' |
|
283 | + ), |
|
284 | + $this->registration_model->convert_datetime_for_query( |
|
285 | + 'REG_date', |
|
286 | + $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
287 | + 'Y-m-d H:i:s' |
|
288 | + ), |
|
289 | + ], |
|
290 | + ]; |
|
291 | + } |
|
292 | + } |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + /** |
|
297 | + * Adds any provided search restraints to the where conditions for the registrations query |
|
298 | + */ |
|
299 | + protected function addSearchToWhereConditions() |
|
300 | + { |
|
301 | + $search = $this->request->getRequestParam('s'); |
|
302 | + if ($search) { |
|
303 | + $search_string = '%' . sanitize_text_field($search) . '%'; |
|
304 | + $this->where_params['OR*search_conditions'] = [ |
|
305 | + 'Event.EVT_name' => ['LIKE', $search_string], |
|
306 | + 'Event.EVT_desc' => ['LIKE', $search_string], |
|
307 | + 'Event.EVT_short_desc' => ['LIKE', $search_string], |
|
308 | + 'Attendee.ATT_full_name' => ['LIKE', $search_string], |
|
309 | + 'Attendee.ATT_fname' => ['LIKE', $search_string], |
|
310 | + 'Attendee.ATT_lname' => ['LIKE', $search_string], |
|
311 | + 'Attendee.ATT_short_bio' => ['LIKE', $search_string], |
|
312 | + 'Attendee.ATT_email' => ['LIKE', $search_string], |
|
313 | + 'Attendee.ATT_address' => ['LIKE', $search_string], |
|
314 | + 'Attendee.ATT_address2' => ['LIKE', $search_string], |
|
315 | + 'Attendee.ATT_city' => ['LIKE', $search_string], |
|
316 | + 'REG_final_price' => ['LIKE', $search_string], |
|
317 | + 'REG_code' => ['LIKE', $search_string], |
|
318 | + 'REG_count' => ['LIKE', $search_string], |
|
319 | + 'REG_group_size' => ['LIKE', $search_string], |
|
320 | + 'Ticket.TKT_name' => ['LIKE', $search_string], |
|
321 | + 'Ticket.TKT_description' => ['LIKE', $search_string], |
|
322 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => ['LIKE', $search_string], |
|
323 | + ]; |
|
324 | + } |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * Sets up the orderby for the registrations query. |
|
330 | + * |
|
331 | + * @return array |
|
332 | + */ |
|
333 | + protected function getOrderbyClause() |
|
334 | + { |
|
335 | + $orderby_field = $this->request->getRequestParam('orderby'); |
|
336 | + $orderby_field = $orderby_field ? sanitize_text_field($orderby_field) : '_REG_date'; |
|
337 | + switch ($orderby_field) { |
|
338 | + case '_REG_ID': |
|
339 | + $orderby = ['REG_ID']; |
|
340 | + break; |
|
341 | + case '_Reg_status': |
|
342 | + $orderby = ['STS_ID']; |
|
343 | + break; |
|
344 | + case 'ATT_fname': |
|
345 | + $orderby = ['Attendee.ATT_fname', 'Attendee.ATT_lname']; |
|
346 | + break; |
|
347 | + case 'ATT_lname': |
|
348 | + $orderby = ['Attendee.ATT_lname', 'Attendee.ATT_fname']; |
|
349 | + break; |
|
350 | + case 'event_name': |
|
351 | + $orderby = ['Event.EVT_name']; |
|
352 | + break; |
|
353 | + case 'DTT_EVT_start': |
|
354 | + $orderby = ['Event.Datetime.DTT_EVT_start']; |
|
355 | + break; |
|
356 | + case '_REG_date': |
|
357 | + $orderby = ['REG_date']; |
|
358 | + break; |
|
359 | + default: |
|
360 | + $orderby = [$orderby_field]; |
|
361 | + break; |
|
362 | + } |
|
363 | + $order = $this->request->getRequestParam('order'); |
|
364 | + $order = $order ? sanitize_text_field($order) : 'DESC'; |
|
365 | + |
|
366 | + $orderby = array_combine( |
|
367 | + $orderby, |
|
368 | + array_fill(0, count($orderby), $order) |
|
369 | + ); |
|
370 | + // because there are many registrations with the same date, define |
|
371 | + // a secondary way to order them, otherwise MySQL seems to be a bit random |
|
372 | + if (empty($orderby['REG_ID'])) { |
|
373 | + $orderby['REG_ID'] = $order; |
|
374 | + } |
|
375 | + |
|
376 | + $orderby = apply_filters( |
|
377 | + 'FHEE__Registrations_Admin_Page___get_orderby_for_registrations_query', |
|
378 | + $orderby, |
|
379 | + $this->request->requestParams() |
|
380 | + ); |
|
381 | + return ['order_by' => $orderby]; |
|
382 | + } |
|
383 | + |
|
384 | + |
|
385 | + /** |
|
386 | + * Sets up the limit for the registrations query. |
|
387 | + * |
|
388 | + * @param $per_page |
|
389 | + * @return array |
|
390 | + */ |
|
391 | + protected function getLimitClause($per_page) |
|
392 | + { |
|
393 | + $current_page = $this->request->getRequestParam('paged'); |
|
394 | + $current_page = $current_page ? absint($current_page) : 1; |
|
395 | + $per_page = (int) $this->request->getRequestParam('perpage', $per_page); |
|
396 | + // -1 means return all results so get out if that's set. |
|
397 | + if ($per_page === -1) { |
|
398 | + return []; |
|
399 | + } |
|
400 | + $per_page = absint($per_page); |
|
401 | + $offset = ($current_page - 1) * $per_page; |
|
402 | + return ['limit' => [$offset, $per_page]]; |
|
403 | + } |
|
404 | 404 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'caps' => EEM_Registration::caps_read_admin, |
83 | 83 | 'default_where_conditions' => 'this_model_only', |
84 | 84 | ]; |
85 | - if (! $count_query) { |
|
85 | + if ( ! $count_query) { |
|
86 | 86 | $query_params = array_merge( |
87 | 87 | $query_params, |
88 | 88 | $this->getOrderbyClause(), |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | [ |
229 | 229 | $this->registration_model->convert_datetime_for_query( |
230 | 230 | 'REG_date', |
231 | - $now . ' 00:00:00', |
|
231 | + $now.' 00:00:00', |
|
232 | 232 | 'Y-m-d H:i:s' |
233 | 233 | ), |
234 | 234 | $this->registration_model->convert_datetime_for_query( |
235 | 235 | 'REG_date', |
236 | - $now . ' 23:59:59', |
|
236 | + $now.' 23:59:59', |
|
237 | 237 | 'Y-m-d H:i:s' |
238 | 238 | ), |
239 | 239 | ], |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | [ |
249 | 249 | $this->registration_model->convert_datetime_for_query( |
250 | 250 | 'REG_date', |
251 | - $current_year_and_month . '-01 00:00:00', |
|
251 | + $current_year_and_month.'-01 00:00:00', |
|
252 | 252 | 'Y-m-d H:i:s' |
253 | 253 | ), |
254 | 254 | $this->registration_model->convert_datetime_for_query( |
255 | 255 | 'REG_date', |
256 | - $current_year_and_month . '-' . $days_this_month . ' 23:59:59', |
|
256 | + $current_year_and_month.'-'.$days_this_month.' 23:59:59', |
|
257 | 257 | 'Y-m-d H:i:s' |
258 | 258 | ), |
259 | 259 | ], |
@@ -272,18 +272,18 @@ discard block |
||
272 | 272 | : ''; |
273 | 273 | // if there is not a month or year then we can't go further |
274 | 274 | if ($month_requested && $year_requested) { |
275 | - $days_in_month = date('t', strtotime($year_requested . '-' . $month_requested . '-' . '01')); |
|
275 | + $days_in_month = date('t', strtotime($year_requested.'-'.$month_requested.'-'.'01')); |
|
276 | 276 | $this->where_params['REG_date'] = [ |
277 | 277 | 'BETWEEN', |
278 | 278 | [ |
279 | 279 | $this->registration_model->convert_datetime_for_query( |
280 | 280 | 'REG_date', |
281 | - $year_requested . '-' . $month_requested . '-01 00:00:00', |
|
281 | + $year_requested.'-'.$month_requested.'-01 00:00:00', |
|
282 | 282 | 'Y-m-d H:i:s' |
283 | 283 | ), |
284 | 284 | $this->registration_model->convert_datetime_for_query( |
285 | 285 | 'REG_date', |
286 | - $year_requested . '-' . $month_requested . '-' . $days_in_month . ' 23:59:59', |
|
286 | + $year_requested.'-'.$month_requested.'-'.$days_in_month.' 23:59:59', |
|
287 | 287 | 'Y-m-d H:i:s' |
288 | 288 | ), |
289 | 289 | ], |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | { |
301 | 301 | $search = $this->request->getRequestParam('s'); |
302 | 302 | if ($search) { |
303 | - $search_string = '%' . sanitize_text_field($search) . '%'; |
|
303 | + $search_string = '%'.sanitize_text_field($search).'%'; |
|
304 | 304 | $this->where_params['OR*search_conditions'] = [ |
305 | 305 | 'Event.EVT_name' => ['LIKE', $search_string], |
306 | 306 | 'Event.EVT_desc' => ['LIKE', $search_string], |
@@ -17,128 +17,128 @@ |
||
17 | 17 | class RequestTypeContextFactory implements RequestTypeContextFactoryInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var LoaderInterface $loader |
|
22 | - */ |
|
23 | - private $loader; |
|
20 | + /** |
|
21 | + * @var LoaderInterface $loader |
|
22 | + */ |
|
23 | + private $loader; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * RequestTypeContextFactory constructor. |
|
28 | - * |
|
29 | - * @param LoaderInterface $loader |
|
30 | - */ |
|
31 | - public function __construct(LoaderInterface $loader) |
|
32 | - { |
|
33 | - $this->loader = $loader; |
|
34 | - } |
|
26 | + /** |
|
27 | + * RequestTypeContextFactory constructor. |
|
28 | + * |
|
29 | + * @param LoaderInterface $loader |
|
30 | + */ |
|
31 | + public function __construct(LoaderInterface $loader) |
|
32 | + { |
|
33 | + $this->loader = $loader; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @param string $slug |
|
39 | - * @return RequestTypeContext |
|
40 | - */ |
|
41 | - public function create($slug) |
|
42 | - { |
|
43 | - switch ($slug) { |
|
44 | - case RequestTypeContext::ACTIVATION: |
|
45 | - $description = esc_html__( |
|
46 | - 'The current request is for some form of activation', |
|
47 | - 'event_espresso' |
|
48 | - ); |
|
49 | - break; |
|
50 | - case RequestTypeContext::API: |
|
51 | - $description = esc_html__( |
|
52 | - 'The current request is for the EE REST API', |
|
53 | - 'event_espresso' |
|
54 | - ); |
|
55 | - break; |
|
56 | - case RequestTypeContext::AJAX_FRONT: |
|
57 | - $description = esc_html__( |
|
58 | - 'The current request is for the frontend via AJAX', |
|
59 | - 'event_espresso' |
|
60 | - ); |
|
61 | - break; |
|
62 | - case RequestTypeContext::AJAX_ADMIN: |
|
63 | - $description = esc_html__( |
|
64 | - 'The current request is for the admin via AJAX', |
|
65 | - 'event_espresso' |
|
66 | - ); |
|
67 | - break; |
|
68 | - case RequestTypeContext::AJAX_HEARTBEAT: |
|
69 | - $description = esc_html__( |
|
70 | - 'The current request is for the WP Heartbeat', |
|
71 | - 'event_espresso' |
|
72 | - ); |
|
73 | - break; |
|
74 | - case RequestTypeContext::AJAX_OTHER: |
|
75 | - $description = esc_html__( |
|
76 | - 'The current request is for non-EE related code via AJAX', |
|
77 | - 'event_espresso' |
|
78 | - ); |
|
79 | - break; |
|
80 | - case RequestTypeContext::CRON: |
|
81 | - $description = esc_html__( |
|
82 | - 'The current request is for a WP_Cron', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - break; |
|
86 | - case RequestTypeContext::CLI: |
|
87 | - $description = esc_html__( |
|
88 | - 'The current request is from the command line', |
|
89 | - 'event_espresso' |
|
90 | - ); |
|
91 | - break; |
|
92 | - case RequestTypeContext::ADMIN: |
|
93 | - $description = esc_html__( |
|
94 | - 'The current request is for the admin', |
|
95 | - 'event_espresso' |
|
96 | - ); |
|
97 | - break; |
|
98 | - case RequestTypeContext::IFRAME: |
|
99 | - $description = esc_html__( |
|
100 | - 'The current request is for an iframe', |
|
101 | - 'event_espresso' |
|
102 | - ); |
|
103 | - break; |
|
104 | - case RequestTypeContext::FEED: |
|
105 | - $description = esc_html__( |
|
106 | - 'The current request is for a feed (ie: RSS)', |
|
107 | - 'event_espresso' |
|
108 | - ); |
|
109 | - break; |
|
110 | - case RequestTypeContext::GQL: |
|
111 | - $description = esc_html__( |
|
112 | - 'The current request is for the EE GraphQL Manager', |
|
113 | - 'event_espresso' |
|
114 | - ); |
|
115 | - break; |
|
116 | - case RequestTypeContext::WP_API: |
|
117 | - $description = esc_html__( |
|
118 | - 'The current request is for the WordPress REST API', |
|
119 | - 'event_espresso' |
|
120 | - ); |
|
121 | - break; |
|
122 | - case RequestTypeContext::WP_SCRAPE: |
|
123 | - $description = esc_html__( |
|
124 | - 'The current request is for a WordPress loopback scrape', |
|
125 | - 'event_espresso' |
|
126 | - ); |
|
127 | - break; |
|
128 | - case RequestTypeContext::FRONTEND: |
|
129 | - default: |
|
130 | - $description = esc_html__( |
|
131 | - 'The current request is for the frontend', |
|
132 | - 'event_espresso' |
|
133 | - ); |
|
134 | - break; |
|
135 | - } |
|
136 | - // we're using the Loader with sharing turned on, |
|
137 | - // so that the generated RequestTypeContext object is accessible anywhere |
|
138 | - // by simply requesting it again from the loader |
|
139 | - return $this->loader->getShared( |
|
140 | - 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
141 | - array($slug, $description) |
|
142 | - ); |
|
143 | - } |
|
37 | + /** |
|
38 | + * @param string $slug |
|
39 | + * @return RequestTypeContext |
|
40 | + */ |
|
41 | + public function create($slug) |
|
42 | + { |
|
43 | + switch ($slug) { |
|
44 | + case RequestTypeContext::ACTIVATION: |
|
45 | + $description = esc_html__( |
|
46 | + 'The current request is for some form of activation', |
|
47 | + 'event_espresso' |
|
48 | + ); |
|
49 | + break; |
|
50 | + case RequestTypeContext::API: |
|
51 | + $description = esc_html__( |
|
52 | + 'The current request is for the EE REST API', |
|
53 | + 'event_espresso' |
|
54 | + ); |
|
55 | + break; |
|
56 | + case RequestTypeContext::AJAX_FRONT: |
|
57 | + $description = esc_html__( |
|
58 | + 'The current request is for the frontend via AJAX', |
|
59 | + 'event_espresso' |
|
60 | + ); |
|
61 | + break; |
|
62 | + case RequestTypeContext::AJAX_ADMIN: |
|
63 | + $description = esc_html__( |
|
64 | + 'The current request is for the admin via AJAX', |
|
65 | + 'event_espresso' |
|
66 | + ); |
|
67 | + break; |
|
68 | + case RequestTypeContext::AJAX_HEARTBEAT: |
|
69 | + $description = esc_html__( |
|
70 | + 'The current request is for the WP Heartbeat', |
|
71 | + 'event_espresso' |
|
72 | + ); |
|
73 | + break; |
|
74 | + case RequestTypeContext::AJAX_OTHER: |
|
75 | + $description = esc_html__( |
|
76 | + 'The current request is for non-EE related code via AJAX', |
|
77 | + 'event_espresso' |
|
78 | + ); |
|
79 | + break; |
|
80 | + case RequestTypeContext::CRON: |
|
81 | + $description = esc_html__( |
|
82 | + 'The current request is for a WP_Cron', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + break; |
|
86 | + case RequestTypeContext::CLI: |
|
87 | + $description = esc_html__( |
|
88 | + 'The current request is from the command line', |
|
89 | + 'event_espresso' |
|
90 | + ); |
|
91 | + break; |
|
92 | + case RequestTypeContext::ADMIN: |
|
93 | + $description = esc_html__( |
|
94 | + 'The current request is for the admin', |
|
95 | + 'event_espresso' |
|
96 | + ); |
|
97 | + break; |
|
98 | + case RequestTypeContext::IFRAME: |
|
99 | + $description = esc_html__( |
|
100 | + 'The current request is for an iframe', |
|
101 | + 'event_espresso' |
|
102 | + ); |
|
103 | + break; |
|
104 | + case RequestTypeContext::FEED: |
|
105 | + $description = esc_html__( |
|
106 | + 'The current request is for a feed (ie: RSS)', |
|
107 | + 'event_espresso' |
|
108 | + ); |
|
109 | + break; |
|
110 | + case RequestTypeContext::GQL: |
|
111 | + $description = esc_html__( |
|
112 | + 'The current request is for the EE GraphQL Manager', |
|
113 | + 'event_espresso' |
|
114 | + ); |
|
115 | + break; |
|
116 | + case RequestTypeContext::WP_API: |
|
117 | + $description = esc_html__( |
|
118 | + 'The current request is for the WordPress REST API', |
|
119 | + 'event_espresso' |
|
120 | + ); |
|
121 | + break; |
|
122 | + case RequestTypeContext::WP_SCRAPE: |
|
123 | + $description = esc_html__( |
|
124 | + 'The current request is for a WordPress loopback scrape', |
|
125 | + 'event_espresso' |
|
126 | + ); |
|
127 | + break; |
|
128 | + case RequestTypeContext::FRONTEND: |
|
129 | + default: |
|
130 | + $description = esc_html__( |
|
131 | + 'The current request is for the frontend', |
|
132 | + 'event_espresso' |
|
133 | + ); |
|
134 | + break; |
|
135 | + } |
|
136 | + // we're using the Loader with sharing turned on, |
|
137 | + // so that the generated RequestTypeContext object is accessible anywhere |
|
138 | + // by simply requesting it again from the loader |
|
139 | + return $this->loader->getShared( |
|
140 | + 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
141 | + array($slug, $description) |
|
142 | + ); |
|
143 | + } |
|
144 | 144 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $jsonDates = []; |
38 | 38 | foreach ($datetimes as $datetime) { |
39 | 39 | if ($datetime instanceof EE_Datetime) { |
40 | - $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime); |
|
40 | + $jsonDates[$datetime->ID()] = $this->convertAndEncode($datetime); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | return $jsonDates; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $arrayOfDates = []; |
76 | 76 | foreach ($datetimes as $datetime) { |
77 | 77 | if ($datetime instanceof EE_Datetime) { |
78 | - $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime); |
|
78 | + $arrayOfDates[$datetime->ID()] = $this->convert($datetime); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | return $arrayOfDates; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $jsonDates = []; |
128 | 128 | foreach ($datetimes as $datetime) { |
129 | 129 | if ($datetime instanceof EE_Datetime) { |
130 | - $jsonDates[ $datetime->ID() ] = $this->encode($datetime); |
|
130 | + $jsonDates[$datetime->ID()] = $this->encode($datetime); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | return $jsonDates; |
@@ -22,125 +22,125 @@ |
||
22 | 22 | class DatetimeToJson implements ModelObjectToJsonConverterInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @param EE_Datetime[] $datetimes |
|
27 | - * @return array |
|
28 | - * @throws EE_Error |
|
29 | - * @throws InvalidArgumentException |
|
30 | - * @throws InvalidDataTypeException |
|
31 | - * @throws InvalidInterfaceException |
|
32 | - * @throws ReflectionException |
|
33 | - * @since $VID:$ |
|
34 | - */ |
|
35 | - public function convertAndEncodeArrayOf(array $datetimes) |
|
36 | - { |
|
37 | - $jsonDates = []; |
|
38 | - foreach ($datetimes as $datetime) { |
|
39 | - if ($datetime instanceof EE_Datetime) { |
|
40 | - $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime); |
|
41 | - } |
|
42 | - } |
|
43 | - return $jsonDates; |
|
44 | - } |
|
25 | + /** |
|
26 | + * @param EE_Datetime[] $datetimes |
|
27 | + * @return array |
|
28 | + * @throws EE_Error |
|
29 | + * @throws InvalidArgumentException |
|
30 | + * @throws InvalidDataTypeException |
|
31 | + * @throws InvalidInterfaceException |
|
32 | + * @throws ReflectionException |
|
33 | + * @since $VID:$ |
|
34 | + */ |
|
35 | + public function convertAndEncodeArrayOf(array $datetimes) |
|
36 | + { |
|
37 | + $jsonDates = []; |
|
38 | + foreach ($datetimes as $datetime) { |
|
39 | + if ($datetime instanceof EE_Datetime) { |
|
40 | + $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime); |
|
41 | + } |
|
42 | + } |
|
43 | + return $jsonDates; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @param EE_Datetime $datetime |
|
49 | - * @return false|string |
|
50 | - * @throws EE_Error |
|
51 | - * @throws InvalidArgumentException |
|
52 | - * @throws InvalidDataTypeException |
|
53 | - * @throws InvalidInterfaceException |
|
54 | - * @throws ReflectionException |
|
55 | - * @since $VID:$ |
|
56 | - */ |
|
57 | - public function convertAndEncode($datetime) |
|
58 | - { |
|
59 | - return $datetime instanceof EE_Datetime ? $this->encode($this->convert($datetime)) : false; |
|
60 | - } |
|
47 | + /** |
|
48 | + * @param EE_Datetime $datetime |
|
49 | + * @return false|string |
|
50 | + * @throws EE_Error |
|
51 | + * @throws InvalidArgumentException |
|
52 | + * @throws InvalidDataTypeException |
|
53 | + * @throws InvalidInterfaceException |
|
54 | + * @throws ReflectionException |
|
55 | + * @since $VID:$ |
|
56 | + */ |
|
57 | + public function convertAndEncode($datetime) |
|
58 | + { |
|
59 | + return $datetime instanceof EE_Datetime ? $this->encode($this->convert($datetime)) : false; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * @param EE_Datetime[] $datetimes |
|
65 | - * @return array |
|
66 | - * @throws EE_Error |
|
67 | - * @throws InvalidArgumentException |
|
68 | - * @throws InvalidDataTypeException |
|
69 | - * @throws InvalidInterfaceException |
|
70 | - * @throws ReflectionException |
|
71 | - * @since $VID:$ |
|
72 | - */ |
|
73 | - public function convertArrayOf(array $datetimes) |
|
74 | - { |
|
75 | - $arrayOfDates = []; |
|
76 | - foreach ($datetimes as $datetime) { |
|
77 | - if ($datetime instanceof EE_Datetime) { |
|
78 | - $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime); |
|
79 | - } |
|
80 | - } |
|
81 | - return $arrayOfDates; |
|
82 | - } |
|
63 | + /** |
|
64 | + * @param EE_Datetime[] $datetimes |
|
65 | + * @return array |
|
66 | + * @throws EE_Error |
|
67 | + * @throws InvalidArgumentException |
|
68 | + * @throws InvalidDataTypeException |
|
69 | + * @throws InvalidInterfaceException |
|
70 | + * @throws ReflectionException |
|
71 | + * @since $VID:$ |
|
72 | + */ |
|
73 | + public function convertArrayOf(array $datetimes) |
|
74 | + { |
|
75 | + $arrayOfDates = []; |
|
76 | + foreach ($datetimes as $datetime) { |
|
77 | + if ($datetime instanceof EE_Datetime) { |
|
78 | + $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime); |
|
79 | + } |
|
80 | + } |
|
81 | + return $arrayOfDates; |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * @param EE_Datetime $datetime |
|
87 | - * @return array |
|
88 | - * @throws EE_Error |
|
89 | - * @throws InvalidDataTypeException |
|
90 | - * @throws InvalidInterfaceException |
|
91 | - * @throws InvalidArgumentException |
|
92 | - * @throws ReflectionException |
|
93 | - * @since $VID:$ |
|
94 | - */ |
|
95 | - public function convert($datetime) |
|
96 | - { |
|
97 | - return $datetime instanceof EE_Datetime ? [ |
|
98 | - 'DTT_ID' => $datetime->ID(), |
|
99 | - 'EVT_ID' => $datetime->event() instanceof EE_Event ? $datetime->event()->ID() : 0, |
|
100 | - 'DTT_name' => $datetime->name(), |
|
101 | - 'DTT_description' => $datetime->description(), |
|
102 | - 'DTT_EVT_start' => $datetime->start_date(DATE_ATOM), |
|
103 | - 'DTT_EVT_end' => $datetime->end_date(DATE_ATOM), |
|
104 | - 'DTT_sold' => $datetime->sold(), |
|
105 | - 'DTT_reserved' => $datetime->reserved(), |
|
106 | - 'DTT_reg_limit' => $datetime->reg_limit() === INF ? -1 : $datetime->reg_limit(), |
|
107 | - 'DTT_is_primary' => $datetime->get_active_status(), |
|
108 | - 'DTT_order' => $datetime->order(), |
|
109 | - 'DTT_parent' => $datetime->parent(), |
|
110 | - 'DTT_deleted' => $datetime->get('DTT_deleted'), |
|
111 | - ] : []; |
|
112 | - } |
|
85 | + /** |
|
86 | + * @param EE_Datetime $datetime |
|
87 | + * @return array |
|
88 | + * @throws EE_Error |
|
89 | + * @throws InvalidDataTypeException |
|
90 | + * @throws InvalidInterfaceException |
|
91 | + * @throws InvalidArgumentException |
|
92 | + * @throws ReflectionException |
|
93 | + * @since $VID:$ |
|
94 | + */ |
|
95 | + public function convert($datetime) |
|
96 | + { |
|
97 | + return $datetime instanceof EE_Datetime ? [ |
|
98 | + 'DTT_ID' => $datetime->ID(), |
|
99 | + 'EVT_ID' => $datetime->event() instanceof EE_Event ? $datetime->event()->ID() : 0, |
|
100 | + 'DTT_name' => $datetime->name(), |
|
101 | + 'DTT_description' => $datetime->description(), |
|
102 | + 'DTT_EVT_start' => $datetime->start_date(DATE_ATOM), |
|
103 | + 'DTT_EVT_end' => $datetime->end_date(DATE_ATOM), |
|
104 | + 'DTT_sold' => $datetime->sold(), |
|
105 | + 'DTT_reserved' => $datetime->reserved(), |
|
106 | + 'DTT_reg_limit' => $datetime->reg_limit() === INF ? -1 : $datetime->reg_limit(), |
|
107 | + 'DTT_is_primary' => $datetime->get_active_status(), |
|
108 | + 'DTT_order' => $datetime->order(), |
|
109 | + 'DTT_parent' => $datetime->parent(), |
|
110 | + 'DTT_deleted' => $datetime->get('DTT_deleted'), |
|
111 | + ] : []; |
|
112 | + } |
|
113 | 113 | |
114 | 114 | |
115 | - /** |
|
116 | - * @param EE_Datetime[] $datetimes |
|
117 | - * @return array |
|
118 | - * @throws EE_Error |
|
119 | - * @throws InvalidArgumentException |
|
120 | - * @throws InvalidDataTypeException |
|
121 | - * @throws InvalidInterfaceException |
|
122 | - * @throws ReflectionException |
|
123 | - * @since $VID:$ |
|
124 | - */ |
|
125 | - public function encodeArrayOf(array $datetimes) |
|
126 | - { |
|
127 | - $jsonDates = []; |
|
128 | - foreach ($datetimes as $datetime) { |
|
129 | - if ($datetime instanceof EE_Datetime) { |
|
130 | - $jsonDates[ $datetime->ID() ] = $this->encode($datetime); |
|
131 | - } |
|
132 | - } |
|
133 | - return $jsonDates; |
|
134 | - } |
|
115 | + /** |
|
116 | + * @param EE_Datetime[] $datetimes |
|
117 | + * @return array |
|
118 | + * @throws EE_Error |
|
119 | + * @throws InvalidArgumentException |
|
120 | + * @throws InvalidDataTypeException |
|
121 | + * @throws InvalidInterfaceException |
|
122 | + * @throws ReflectionException |
|
123 | + * @since $VID:$ |
|
124 | + */ |
|
125 | + public function encodeArrayOf(array $datetimes) |
|
126 | + { |
|
127 | + $jsonDates = []; |
|
128 | + foreach ($datetimes as $datetime) { |
|
129 | + if ($datetime instanceof EE_Datetime) { |
|
130 | + $jsonDates[ $datetime->ID() ] = $this->encode($datetime); |
|
131 | + } |
|
132 | + } |
|
133 | + return $jsonDates; |
|
134 | + } |
|
135 | 135 | |
136 | 136 | |
137 | - /** |
|
138 | - * @param array $datetime_array |
|
139 | - * @return false|string |
|
140 | - * @since $VID:$ |
|
141 | - */ |
|
142 | - public function encode(array $datetime_array) |
|
143 | - { |
|
144 | - return wp_json_encode($datetime_array); |
|
145 | - } |
|
137 | + /** |
|
138 | + * @param array $datetime_array |
|
139 | + * @return false|string |
|
140 | + * @since $VID:$ |
|
141 | + */ |
|
142 | + public function encode(array $datetime_array) |
|
143 | + { |
|
144 | + return wp_json_encode($datetime_array); |
|
145 | + } |
|
146 | 146 | } |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | <?php if (!is_admin()) : ?> |
7 | 7 | <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text"> |
8 | 8 | <?php echo apply_filters( |
9 | - 'FHEE__registration_page_attendee_information__attendee_information_pg', |
|
10 | - sprintf( |
|
11 | - __( |
|
12 | - 'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', |
|
13 | - 'event_espresso' |
|
14 | - ), |
|
15 | - '<br />', |
|
16 | - '<span class="asterisk">*</span>' |
|
17 | - ) |
|
18 | - ); ?> |
|
9 | + 'FHEE__registration_page_attendee_information__attendee_information_pg', |
|
10 | + sprintf( |
|
11 | + __( |
|
12 | + 'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', |
|
13 | + 'event_espresso' |
|
14 | + ), |
|
15 | + '<br />', |
|
16 | + '<span class="asterisk">*</span>' |
|
17 | + ) |
|
18 | + ); ?> |
|
19 | 19 | </p> |
20 | 20 | <?php endif; ?> |
21 | 21 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | $prev_ticket = 0; |
26 | 26 | |
27 | 27 | if (count($registrations) > 0) { |
28 | - foreach ($registrations as $registration) { |
|
29 | - if ($registration instanceof EE_Registration) { |
|
30 | - $att_nmbr++; |
|
31 | - ?> |
|
28 | + foreach ($registrations as $registration) { |
|
29 | + if ($registration instanceof EE_Registration) { |
|
30 | + $att_nmbr++; |
|
31 | + ?> |
|
32 | 32 | |
33 | 33 | <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>" |
34 | 34 | class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>"> |
@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | <th scope="col" width="" class="jst-left"><?php _e('Name and Description', 'event_espresso'); ?></th> |
51 | 51 | <th scope="col" width="7.5%" class="jst-rght"> |
52 | 52 | <?php _e( |
53 | - 'Qty', |
|
54 | - 'event_espresso' |
|
55 | - ); ?></th> |
|
53 | + 'Qty', |
|
54 | + 'event_espresso' |
|
55 | + ); ?></th> |
|
56 | 56 | <th scope="col" width="17.5%" class="jst-rght"> |
57 | 57 | <?php _e( |
58 | - 'Price', |
|
59 | - 'event_espresso' |
|
60 | - ); ?></th> |
|
58 | + 'Price', |
|
59 | + 'event_espresso' |
|
60 | + ); ?></th> |
|
61 | 61 | <th scope="col" width="17.5%" class="jst-rght"> |
62 | 62 | <?php _e( |
63 | - 'Total', |
|
64 | - 'event_espresso' |
|
65 | - ); ?></th> |
|
63 | + 'Total', |
|
64 | + 'event_espresso' |
|
65 | + ); ?></th> |
|
66 | 66 | </tr> |
67 | 67 | </thead> |
68 | 68 | <tbody> |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | <?php } ?> |
75 | 75 | |
76 | 76 | <?php |
77 | - // ATTENDEE QUESTIONS |
|
78 | - $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link()); |
|
79 | - echo ${$reg_form}; |
|
80 | - ?> |
|
77 | + // ATTENDEE QUESTIONS |
|
78 | + $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link()); |
|
79 | + echo ${$reg_form}; |
|
80 | + ?> |
|
81 | 81 | |
82 | 82 | </div> |
83 | 83 | <?php |
84 | - $prev_event = $registration->event()->ID(); |
|
85 | - $prev_ticket = $registration->ticket()->ID(); |
|
86 | - } // if ( $registration instanceof EE_Registration ) |
|
87 | - } // end foreach ( $registrations as $registration ) |
|
84 | + $prev_event = $registration->event()->ID(); |
|
85 | + $prev_ticket = $registration->ticket()->ID(); |
|
86 | + } // if ( $registration instanceof EE_Registration ) |
|
87 | + } // end foreach ( $registrations as $registration ) |
|
88 | 88 | |
89 | - echo $default_hidden_inputs; |
|
89 | + echo $default_hidden_inputs; |
|
90 | 90 | } // end if ( count( $registrations ) > 0 ) |
91 | 91 | |
92 | 92 | ?> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | /** @var array $ticket_line_item */ |
4 | 4 | /** @var string $default_hidden_inputs */ |
5 | 5 | ?> |
6 | -<?php if (!is_admin()) : ?> |
|
6 | +<?php if ( ! is_admin()) : ?> |
|
7 | 7 | <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text"> |
8 | 8 | <?php echo apply_filters( |
9 | 9 | 'FHEE__registration_page_attendee_information__attendee_information_pg', |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>" |
34 | 34 | class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>"> |
35 | 35 | |
36 | - <?php if (!is_admin() && $registration->event()->ID() !== $prev_event) { ?> |
|
36 | + <?php if ( ! is_admin() && $registration->event()->ID() !== $prev_event) { ?> |
|
37 | 37 | <h4 id="event_title-<?php echo $registration->event()->ID() ?>" class="big-event-title-hdr"> |
38 | 38 | <?php echo $registration->event()->name(); ?> |
39 | 39 | </h4> |
40 | 40 | <?php } ?> |
41 | 41 | <?php if ($registration->ticket()->ID() !== $prev_ticket) { ?> |
42 | - <?php if (! $revisit) { ?> |
|
42 | + <?php if ( ! $revisit) { ?> |
|
43 | 43 | <div class="spco-ticket-info-dv small-text"> |
44 | - <?php if (!is_admin()) : ?> |
|
44 | + <?php if ( ! is_admin()) : ?> |
|
45 | 45 | <h5><?php _e('Details', 'event_espresso'); ?></h5> |
46 | 46 | <?php endif; ?> |
47 | 47 | <table class="spco-ticket-details"> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | </tr> |
67 | 67 | </thead> |
68 | 68 | <tbody> |
69 | - <?php echo $ticket_line_item[ $registration->ticket()->ID() ]; ?> |
|
69 | + <?php echo $ticket_line_item[$registration->ticket()->ID()]; ?> |
|
70 | 70 | </tbody> |
71 | 71 | </table> |
72 | 72 | </div> |
@@ -176,7 +176,7 @@ |
||
176 | 176 | $version = '' |
177 | 177 | ) { |
178 | 178 | $dev_suffix = wp_scripts_get_suffix('dev'); |
179 | - $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/'; |
|
179 | + $vendor_path = $this->domain->pluginUrl().'assets/vendor/'; |
|
180 | 180 | return $this->addJavascript( |
181 | 181 | $handle, |
182 | 182 | "{$vendor_path}{$handle}{$dev_suffix}.js", |
@@ -23,332 +23,332 @@ |
||
23 | 23 | abstract class AssetManager implements AssetManagerInterface |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var AssetCollection|Asset[] $assets |
|
28 | - */ |
|
29 | - protected $assets; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var DomainInterface |
|
33 | - */ |
|
34 | - protected $domain; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var Registry $registry |
|
38 | - */ |
|
39 | - protected $registry; |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * AssetRegister constructor. |
|
44 | - * |
|
45 | - * @param DomainInterface $domain |
|
46 | - * @param AssetCollection $assets |
|
47 | - * @param Registry $registry |
|
48 | - */ |
|
49 | - public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry) |
|
50 | - { |
|
51 | - $this->domain = $domain; |
|
52 | - $this->assets = $assets; |
|
53 | - $this->registry = $registry; |
|
54 | - $this->registry->addAssetCollection($assets); |
|
55 | - add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2); |
|
56 | - add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * @return AssetCollection |
|
62 | - */ |
|
63 | - public function getAssets() |
|
64 | - { |
|
65 | - return $this->assets; |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @since 4.9.71.p |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function assetNamespace() |
|
74 | - { |
|
75 | - return $this->domain->assetNamespace(); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @param string $handle |
|
81 | - * @param string $source |
|
82 | - * @param array $dependencies |
|
83 | - * @param bool $load_in_footer |
|
84 | - * @param string $version |
|
85 | - * @return JavascriptAsset |
|
86 | - * @throws DuplicateCollectionIdentifierException |
|
87 | - * @throws InvalidDataTypeException |
|
88 | - * @throws InvalidEntityException |
|
89 | - * @throws DomainException |
|
90 | - * @since 4.9.62.p |
|
91 | - */ |
|
92 | - public function addJavascript( |
|
93 | - $handle, |
|
94 | - $source, |
|
95 | - array $dependencies = array(), |
|
96 | - $load_in_footer = true, |
|
97 | - $version = '' |
|
98 | - ) { |
|
99 | - $asset = new JavascriptAsset( |
|
100 | - $handle, |
|
101 | - $source, |
|
102 | - array_unique($dependencies), |
|
103 | - $load_in_footer, |
|
104 | - $this->domain, |
|
105 | - $version |
|
106 | - ); |
|
107 | - $this->assets->add($asset, $handle); |
|
108 | - return $asset; |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * Used to register a javascript asset where everything is dynamically derived from the given handle. |
|
114 | - * |
|
115 | - * @param string $handle |
|
116 | - * @param string|array $extra_dependencies |
|
117 | - * @return JavascriptAsset |
|
118 | - * @throws DuplicateCollectionIdentifierException |
|
119 | - * @throws InvalidDataTypeException |
|
120 | - * @throws InvalidEntityException |
|
121 | - * @throws DomainException |
|
122 | - */ |
|
123 | - public function addJs($handle, $extra_dependencies = []) |
|
124 | - { |
|
125 | - $details = $this->getAssetDetails( |
|
126 | - Asset::TYPE_JS, |
|
127 | - $handle, |
|
128 | - $extra_dependencies |
|
129 | - ); |
|
130 | - $source = $this->registry->getJsUrl($this->domain->assetNamespace(), $handle); |
|
131 | - return $this->addJavascript( |
|
132 | - $handle, |
|
133 | - $source, |
|
134 | - $details['dependencies'], |
|
135 | - true, |
|
136 | - $details['version'] |
|
137 | - ); |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * @param string $handle |
|
143 | - * @param array $dependencies |
|
144 | - * @param bool $load_in_footer |
|
145 | - * @param string $version |
|
146 | - * @return JavascriptAsset |
|
147 | - * @throws DomainException |
|
148 | - * @throws DuplicateCollectionIdentifierException |
|
149 | - * @throws InvalidDataTypeException |
|
150 | - * @throws InvalidEntityException |
|
151 | - * @since 4.9.71.p |
|
152 | - */ |
|
153 | - public function addVendorJavascript( |
|
154 | - $handle, |
|
155 | - array $dependencies = array(), |
|
156 | - $load_in_footer = true, |
|
157 | - $version = '' |
|
158 | - ) { |
|
159 | - $dev_suffix = wp_scripts_get_suffix('dev'); |
|
160 | - $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/'; |
|
161 | - return $this->addJavascript( |
|
162 | - $handle, |
|
163 | - "{$vendor_path}{$handle}{$dev_suffix}.js", |
|
164 | - $dependencies, |
|
165 | - $load_in_footer, |
|
166 | - $version |
|
167 | - ); |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * @param string $handle |
|
173 | - * @param string $source |
|
174 | - * @param array $dependencies |
|
175 | - * @param string $media |
|
176 | - * @param string $version |
|
177 | - * @return StylesheetAsset |
|
178 | - * @throws DomainException |
|
179 | - * @throws DuplicateCollectionIdentifierException |
|
180 | - * @throws InvalidDataTypeException |
|
181 | - * @throws InvalidEntityException |
|
182 | - * @since 4.9.62.p |
|
183 | - */ |
|
184 | - public function addStylesheet( |
|
185 | - $handle, |
|
186 | - $source, |
|
187 | - array $dependencies = array(), |
|
188 | - $media = 'all', |
|
189 | - $version = '' |
|
190 | - ) { |
|
191 | - $asset = new StylesheetAsset( |
|
192 | - $handle, |
|
193 | - $source, |
|
194 | - array_unique($dependencies), |
|
195 | - $this->domain, |
|
196 | - $media, |
|
197 | - $version |
|
198 | - ); |
|
199 | - $this->assets->add($asset, $handle); |
|
200 | - return $asset; |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * Used to register a css asset where everything is dynamically derived from the given handle. |
|
206 | - * |
|
207 | - * @param string $handle |
|
208 | - * @param string|array $extra_dependencies |
|
209 | - * @return StylesheetAsset |
|
210 | - * @throws DuplicateCollectionIdentifierException |
|
211 | - * @throws InvalidDataTypeException |
|
212 | - * @throws InvalidEntityException |
|
213 | - * @throws DomainException |
|
214 | - */ |
|
215 | - public function addCss($handle, $extra_dependencies = []) |
|
216 | - { |
|
217 | - $details = $this->getAssetDetails( |
|
218 | - Asset::TYPE_CSS, |
|
219 | - $handle, |
|
220 | - $extra_dependencies |
|
221 | - ); |
|
222 | - return $this->addStylesheet( |
|
223 | - $handle, |
|
224 | - $this->registry->getCssUrl($this->domain->assetNamespace(), $handle), |
|
225 | - $details['dependencies'], |
|
226 | - 'all', |
|
227 | - $details['version'] |
|
228 | - ); |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - /** |
|
233 | - * @param string $handle |
|
234 | - * @return bool |
|
235 | - * @since 4.9.62.p |
|
236 | - */ |
|
237 | - public function enqueueAsset($handle) |
|
238 | - { |
|
239 | - if ($this->assets->has($handle)) { |
|
240 | - /** @var Asset $asset */ |
|
241 | - $asset = $this->assets->get($handle); |
|
242 | - if ($asset instanceof BrowserAsset && $asset->isRegistered()) { |
|
243 | - $asset->enqueueAsset(); |
|
244 | - return true; |
|
245 | - } |
|
246 | - } |
|
247 | - return false; |
|
248 | - } |
|
249 | - |
|
250 | - |
|
251 | - /** |
|
252 | - * @return void |
|
253 | - * @since $VID:$ |
|
254 | - */ |
|
255 | - public function enqueueBrowserAssets() |
|
256 | - { |
|
257 | - foreach ($this->assets as $asset) { |
|
258 | - if ($asset instanceof BrowserAsset && $asset->isRegistered()) { |
|
259 | - $asset->enqueueAsset(); |
|
260 | - } |
|
261 | - } |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * @param string $asset_type |
|
267 | - * @param string $handle |
|
268 | - * @param array $extra_dependencies |
|
269 | - * @return array |
|
270 | - * @since 4.10.2.p |
|
271 | - */ |
|
272 | - private function getAssetDetails($asset_type, $handle, $extra_dependencies = []) |
|
273 | - { |
|
274 | - $getAssetDetails = ''; |
|
275 | - switch ($asset_type) { |
|
276 | - case Asset::TYPE_JS : |
|
277 | - $getAssetDetails = 'getJsAssetDetails'; |
|
278 | - break; |
|
279 | - case Asset::TYPE_CSS : |
|
280 | - $getAssetDetails = 'getCssAssetDetails'; |
|
281 | - break; |
|
282 | - } |
|
283 | - if ($getAssetDetails === '') { |
|
284 | - return ['dependencies' => [], 'version' => '']; |
|
285 | - } |
|
286 | - $details = $this->registry->$getAssetDetails( |
|
287 | - $this->domain->assetNamespace(), |
|
288 | - $handle |
|
289 | - ); |
|
290 | - $details['dependencies'] = isset($details['dependencies']) |
|
291 | - ? $details['dependencies'] |
|
292 | - : []; |
|
293 | - $details['version'] = isset($details['version']) |
|
294 | - ? $details['version'] |
|
295 | - : ''; |
|
296 | - $details['dependencies'] = ! empty($extra_dependencies) |
|
297 | - ? array_merge($details['dependencies'], (array) $extra_dependencies) |
|
298 | - : $details['dependencies']; |
|
299 | - return $details; |
|
300 | - |
|
301 | - } |
|
302 | - |
|
303 | - |
|
304 | - /** |
|
305 | - * @param string $handle |
|
306 | - * @return bool |
|
307 | - * @throws DomainException |
|
308 | - */ |
|
309 | - public function verifyAssetIsRegistered($handle) |
|
310 | - { |
|
311 | - if (wp_script_is($handle, 'registered')) { |
|
312 | - return true; |
|
313 | - } |
|
314 | - if (WP_DEBUG) { |
|
315 | - throw new DomainException( |
|
316 | - sprintf( |
|
317 | - esc_html__( |
|
318 | - 'The "%1$s" script is not registered when it should be!%2$s |
|
26 | + /** |
|
27 | + * @var AssetCollection|Asset[] $assets |
|
28 | + */ |
|
29 | + protected $assets; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var DomainInterface |
|
33 | + */ |
|
34 | + protected $domain; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var Registry $registry |
|
38 | + */ |
|
39 | + protected $registry; |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * AssetRegister constructor. |
|
44 | + * |
|
45 | + * @param DomainInterface $domain |
|
46 | + * @param AssetCollection $assets |
|
47 | + * @param Registry $registry |
|
48 | + */ |
|
49 | + public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry) |
|
50 | + { |
|
51 | + $this->domain = $domain; |
|
52 | + $this->assets = $assets; |
|
53 | + $this->registry = $registry; |
|
54 | + $this->registry->addAssetCollection($assets); |
|
55 | + add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2); |
|
56 | + add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * @return AssetCollection |
|
62 | + */ |
|
63 | + public function getAssets() |
|
64 | + { |
|
65 | + return $this->assets; |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @since 4.9.71.p |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function assetNamespace() |
|
74 | + { |
|
75 | + return $this->domain->assetNamespace(); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @param string $handle |
|
81 | + * @param string $source |
|
82 | + * @param array $dependencies |
|
83 | + * @param bool $load_in_footer |
|
84 | + * @param string $version |
|
85 | + * @return JavascriptAsset |
|
86 | + * @throws DuplicateCollectionIdentifierException |
|
87 | + * @throws InvalidDataTypeException |
|
88 | + * @throws InvalidEntityException |
|
89 | + * @throws DomainException |
|
90 | + * @since 4.9.62.p |
|
91 | + */ |
|
92 | + public function addJavascript( |
|
93 | + $handle, |
|
94 | + $source, |
|
95 | + array $dependencies = array(), |
|
96 | + $load_in_footer = true, |
|
97 | + $version = '' |
|
98 | + ) { |
|
99 | + $asset = new JavascriptAsset( |
|
100 | + $handle, |
|
101 | + $source, |
|
102 | + array_unique($dependencies), |
|
103 | + $load_in_footer, |
|
104 | + $this->domain, |
|
105 | + $version |
|
106 | + ); |
|
107 | + $this->assets->add($asset, $handle); |
|
108 | + return $asset; |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * Used to register a javascript asset where everything is dynamically derived from the given handle. |
|
114 | + * |
|
115 | + * @param string $handle |
|
116 | + * @param string|array $extra_dependencies |
|
117 | + * @return JavascriptAsset |
|
118 | + * @throws DuplicateCollectionIdentifierException |
|
119 | + * @throws InvalidDataTypeException |
|
120 | + * @throws InvalidEntityException |
|
121 | + * @throws DomainException |
|
122 | + */ |
|
123 | + public function addJs($handle, $extra_dependencies = []) |
|
124 | + { |
|
125 | + $details = $this->getAssetDetails( |
|
126 | + Asset::TYPE_JS, |
|
127 | + $handle, |
|
128 | + $extra_dependencies |
|
129 | + ); |
|
130 | + $source = $this->registry->getJsUrl($this->domain->assetNamespace(), $handle); |
|
131 | + return $this->addJavascript( |
|
132 | + $handle, |
|
133 | + $source, |
|
134 | + $details['dependencies'], |
|
135 | + true, |
|
136 | + $details['version'] |
|
137 | + ); |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * @param string $handle |
|
143 | + * @param array $dependencies |
|
144 | + * @param bool $load_in_footer |
|
145 | + * @param string $version |
|
146 | + * @return JavascriptAsset |
|
147 | + * @throws DomainException |
|
148 | + * @throws DuplicateCollectionIdentifierException |
|
149 | + * @throws InvalidDataTypeException |
|
150 | + * @throws InvalidEntityException |
|
151 | + * @since 4.9.71.p |
|
152 | + */ |
|
153 | + public function addVendorJavascript( |
|
154 | + $handle, |
|
155 | + array $dependencies = array(), |
|
156 | + $load_in_footer = true, |
|
157 | + $version = '' |
|
158 | + ) { |
|
159 | + $dev_suffix = wp_scripts_get_suffix('dev'); |
|
160 | + $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/'; |
|
161 | + return $this->addJavascript( |
|
162 | + $handle, |
|
163 | + "{$vendor_path}{$handle}{$dev_suffix}.js", |
|
164 | + $dependencies, |
|
165 | + $load_in_footer, |
|
166 | + $version |
|
167 | + ); |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * @param string $handle |
|
173 | + * @param string $source |
|
174 | + * @param array $dependencies |
|
175 | + * @param string $media |
|
176 | + * @param string $version |
|
177 | + * @return StylesheetAsset |
|
178 | + * @throws DomainException |
|
179 | + * @throws DuplicateCollectionIdentifierException |
|
180 | + * @throws InvalidDataTypeException |
|
181 | + * @throws InvalidEntityException |
|
182 | + * @since 4.9.62.p |
|
183 | + */ |
|
184 | + public function addStylesheet( |
|
185 | + $handle, |
|
186 | + $source, |
|
187 | + array $dependencies = array(), |
|
188 | + $media = 'all', |
|
189 | + $version = '' |
|
190 | + ) { |
|
191 | + $asset = new StylesheetAsset( |
|
192 | + $handle, |
|
193 | + $source, |
|
194 | + array_unique($dependencies), |
|
195 | + $this->domain, |
|
196 | + $media, |
|
197 | + $version |
|
198 | + ); |
|
199 | + $this->assets->add($asset, $handle); |
|
200 | + return $asset; |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * Used to register a css asset where everything is dynamically derived from the given handle. |
|
206 | + * |
|
207 | + * @param string $handle |
|
208 | + * @param string|array $extra_dependencies |
|
209 | + * @return StylesheetAsset |
|
210 | + * @throws DuplicateCollectionIdentifierException |
|
211 | + * @throws InvalidDataTypeException |
|
212 | + * @throws InvalidEntityException |
|
213 | + * @throws DomainException |
|
214 | + */ |
|
215 | + public function addCss($handle, $extra_dependencies = []) |
|
216 | + { |
|
217 | + $details = $this->getAssetDetails( |
|
218 | + Asset::TYPE_CSS, |
|
219 | + $handle, |
|
220 | + $extra_dependencies |
|
221 | + ); |
|
222 | + return $this->addStylesheet( |
|
223 | + $handle, |
|
224 | + $this->registry->getCssUrl($this->domain->assetNamespace(), $handle), |
|
225 | + $details['dependencies'], |
|
226 | + 'all', |
|
227 | + $details['version'] |
|
228 | + ); |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + /** |
|
233 | + * @param string $handle |
|
234 | + * @return bool |
|
235 | + * @since 4.9.62.p |
|
236 | + */ |
|
237 | + public function enqueueAsset($handle) |
|
238 | + { |
|
239 | + if ($this->assets->has($handle)) { |
|
240 | + /** @var Asset $asset */ |
|
241 | + $asset = $this->assets->get($handle); |
|
242 | + if ($asset instanceof BrowserAsset && $asset->isRegistered()) { |
|
243 | + $asset->enqueueAsset(); |
|
244 | + return true; |
|
245 | + } |
|
246 | + } |
|
247 | + return false; |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + /** |
|
252 | + * @return void |
|
253 | + * @since $VID:$ |
|
254 | + */ |
|
255 | + public function enqueueBrowserAssets() |
|
256 | + { |
|
257 | + foreach ($this->assets as $asset) { |
|
258 | + if ($asset instanceof BrowserAsset && $asset->isRegistered()) { |
|
259 | + $asset->enqueueAsset(); |
|
260 | + } |
|
261 | + } |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + /** |
|
266 | + * @param string $asset_type |
|
267 | + * @param string $handle |
|
268 | + * @param array $extra_dependencies |
|
269 | + * @return array |
|
270 | + * @since 4.10.2.p |
|
271 | + */ |
|
272 | + private function getAssetDetails($asset_type, $handle, $extra_dependencies = []) |
|
273 | + { |
|
274 | + $getAssetDetails = ''; |
|
275 | + switch ($asset_type) { |
|
276 | + case Asset::TYPE_JS : |
|
277 | + $getAssetDetails = 'getJsAssetDetails'; |
|
278 | + break; |
|
279 | + case Asset::TYPE_CSS : |
|
280 | + $getAssetDetails = 'getCssAssetDetails'; |
|
281 | + break; |
|
282 | + } |
|
283 | + if ($getAssetDetails === '') { |
|
284 | + return ['dependencies' => [], 'version' => '']; |
|
285 | + } |
|
286 | + $details = $this->registry->$getAssetDetails( |
|
287 | + $this->domain->assetNamespace(), |
|
288 | + $handle |
|
289 | + ); |
|
290 | + $details['dependencies'] = isset($details['dependencies']) |
|
291 | + ? $details['dependencies'] |
|
292 | + : []; |
|
293 | + $details['version'] = isset($details['version']) |
|
294 | + ? $details['version'] |
|
295 | + : ''; |
|
296 | + $details['dependencies'] = ! empty($extra_dependencies) |
|
297 | + ? array_merge($details['dependencies'], (array) $extra_dependencies) |
|
298 | + : $details['dependencies']; |
|
299 | + return $details; |
|
300 | + |
|
301 | + } |
|
302 | + |
|
303 | + |
|
304 | + /** |
|
305 | + * @param string $handle |
|
306 | + * @return bool |
|
307 | + * @throws DomainException |
|
308 | + */ |
|
309 | + public function verifyAssetIsRegistered($handle) |
|
310 | + { |
|
311 | + if (wp_script_is($handle, 'registered')) { |
|
312 | + return true; |
|
313 | + } |
|
314 | + if (WP_DEBUG) { |
|
315 | + throw new DomainException( |
|
316 | + sprintf( |
|
317 | + esc_html__( |
|
318 | + 'The "%1$s" script is not registered when it should be!%2$s |
|
319 | 319 | Are you running the Barista plugin for development purposes? |
320 | 320 | If so, then you need to build the appropriate assets for this domain.%2$s |
321 | 321 | If you are seeing this error on a live website, then you should not have |
322 | 322 | the WP_DEBUG constant in your wp-config.php file set to "true". |
323 | 323 | Please contact Event Espresso support for more information.', |
324 | - 'event_espresso' |
|
325 | - ), |
|
326 | - $handle, |
|
327 | - '<br />' |
|
328 | - ) |
|
329 | - ); |
|
330 | - } |
|
331 | - return false; |
|
332 | - } |
|
333 | - |
|
334 | - |
|
335 | - /**************** deprecated ****************/ |
|
336 | - |
|
337 | - |
|
338 | - /** |
|
339 | - * @return void |
|
340 | - * @deprecated $VID:$ |
|
341 | - */ |
|
342 | - public function addManifestFile() |
|
343 | - { |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * @return void |
|
349 | - * @deprecated $VID:$ |
|
350 | - */ |
|
351 | - public function getManifestFile() |
|
352 | - { |
|
353 | - } |
|
324 | + 'event_espresso' |
|
325 | + ), |
|
326 | + $handle, |
|
327 | + '<br />' |
|
328 | + ) |
|
329 | + ); |
|
330 | + } |
|
331 | + return false; |
|
332 | + } |
|
333 | + |
|
334 | + |
|
335 | + /**************** deprecated ****************/ |
|
336 | + |
|
337 | + |
|
338 | + /** |
|
339 | + * @return void |
|
340 | + * @deprecated $VID:$ |
|
341 | + */ |
|
342 | + public function addManifestFile() |
|
343 | + { |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * @return void |
|
349 | + * @deprecated $VID:$ |
|
350 | + */ |
|
351 | + public function getManifestFile() |
|
352 | + { |
|
353 | + } |
|
354 | 354 | } |
@@ -14,44 +14,44 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | |
17 | - public function do_initial_loads() |
|
18 | - { |
|
19 | - // we want to use the corresponding admin page object (but not route it!). |
|
20 | - // To do this we just set _routing to false. |
|
21 | - // That way this page object is being loaded on all pages to make sure we hook into admin properly. |
|
22 | - // But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;) |
|
23 | - // This is important because we have hooks that help redirect custom post type saves |
|
24 | - $requested_page = isset($_REQUEST['page']) ? sanitize_text_field($_REQUEST['page']) : ''; |
|
25 | - if ($requested_page !== $this->_menu_map->menu_slug) { |
|
26 | - $this->_routing = false; |
|
27 | - $this->_initialize_admin_page(); |
|
28 | - } else { |
|
29 | - // normal init loads |
|
30 | - $this->_initialize_admin_page(); |
|
31 | - // added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality |
|
32 | - remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization'); |
|
33 | - add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100); |
|
34 | - // end removal of autosave functionality. |
|
35 | - } |
|
36 | - } |
|
17 | + public function do_initial_loads() |
|
18 | + { |
|
19 | + // we want to use the corresponding admin page object (but not route it!). |
|
20 | + // To do this we just set _routing to false. |
|
21 | + // That way this page object is being loaded on all pages to make sure we hook into admin properly. |
|
22 | + // But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;) |
|
23 | + // This is important because we have hooks that help redirect custom post type saves |
|
24 | + $requested_page = isset($_REQUEST['page']) ? sanitize_text_field($_REQUEST['page']) : ''; |
|
25 | + if ($requested_page !== $this->_menu_map->menu_slug) { |
|
26 | + $this->_routing = false; |
|
27 | + $this->_initialize_admin_page(); |
|
28 | + } else { |
|
29 | + // normal init loads |
|
30 | + $this->_initialize_admin_page(); |
|
31 | + // added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality |
|
32 | + remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization'); |
|
33 | + add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100); |
|
34 | + // end removal of autosave functionality. |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - public function wp_just_in_time_script_localization() |
|
40 | - { |
|
41 | - wp_localize_script( |
|
42 | - 'autosave', |
|
43 | - 'autosaveL10n', |
|
44 | - array( |
|
45 | - 'autosaveInterval' => 172800, |
|
46 | - 'savingText' => __('Saving Draft…', 'event_espresso'), |
|
47 | - 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.', 'event_espresso'), |
|
48 | - ) |
|
49 | - ); |
|
50 | - } |
|
39 | + public function wp_just_in_time_script_localization() |
|
40 | + { |
|
41 | + wp_localize_script( |
|
42 | + 'autosave', |
|
43 | + 'autosaveL10n', |
|
44 | + array( |
|
45 | + 'autosaveInterval' => 172800, |
|
46 | + 'savingText' => __('Saving Draft…', 'event_espresso'), |
|
47 | + 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.', 'event_espresso'), |
|
48 | + ) |
|
49 | + ); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | - public function adjust_post_lock_window($interval) |
|
54 | - { |
|
55 | - return 172800; |
|
56 | - } |
|
53 | + public function adjust_post_lock_window($interval) |
|
54 | + { |
|
55 | + return 172800; |
|
56 | + } |
|
57 | 57 | } |
@@ -39,86 +39,86 @@ |
||
39 | 39 | class AdvancedEditorAdminFormSection |
40 | 40 | { |
41 | 41 | |
42 | - /** |
|
43 | - * @var EE_Admin_Config |
|
44 | - */ |
|
45 | - protected $admin_config; |
|
42 | + /** |
|
43 | + * @var EE_Admin_Config |
|
44 | + */ |
|
45 | + protected $admin_config; |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * AdvancedEditorAdminForm constructor. |
|
50 | - * |
|
51 | - * @param EE_Admin_Config $admin_config |
|
52 | - */ |
|
53 | - public function __construct(EE_Admin_Config $admin_config) |
|
54 | - { |
|
55 | - $this->admin_config = $admin_config; |
|
56 | - add_filter( |
|
57 | - 'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections', |
|
58 | - [$this, 'mergeFormSubsections'] |
|
59 | - ); |
|
60 | - add_action( |
|
61 | - 'AHEE__Events_Admin_Page___update_default_event_settings', |
|
62 | - [$this, 'updateAdminFormSettings'], |
|
63 | - 10, |
|
64 | - 2 |
|
65 | - ); |
|
66 | - } |
|
48 | + /** |
|
49 | + * AdvancedEditorAdminForm constructor. |
|
50 | + * |
|
51 | + * @param EE_Admin_Config $admin_config |
|
52 | + */ |
|
53 | + public function __construct(EE_Admin_Config $admin_config) |
|
54 | + { |
|
55 | + $this->admin_config = $admin_config; |
|
56 | + add_filter( |
|
57 | + 'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections', |
|
58 | + [$this, 'mergeFormSubsections'] |
|
59 | + ); |
|
60 | + add_action( |
|
61 | + 'AHEE__Events_Admin_Page___update_default_event_settings', |
|
62 | + [$this, 'updateAdminFormSettings'], |
|
63 | + 10, |
|
64 | + 2 |
|
65 | + ); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | - /** |
|
70 | - * @param array $default_event_settings_form_subsections |
|
71 | - * @return array |
|
72 | - * @since $VID:$ |
|
73 | - */ |
|
74 | - public function mergeFormSubsections(array $default_event_settings_form_subsections) |
|
75 | - { |
|
76 | - return [ |
|
77 | - 'use_advanced_editor' => new EE_Select_Input( |
|
78 | - apply_filters( |
|
79 | - 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_answer_options', |
|
80 | - [ |
|
81 | - esc_html__('Legacy Editor', 'event_espresso'), |
|
82 | - esc_html__('Advanced Editor', 'event_espresso'), |
|
83 | - ] |
|
84 | - ), |
|
85 | - apply_filters( |
|
86 | - 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_settings', |
|
87 | - [ |
|
88 | - 'default' => $this->admin_config->useAdvancedEditor(), |
|
89 | - 'html_label_text' => esc_html__('Activate Advanced Editor?', 'event_espresso'), |
|
90 | - 'html_help_text' => sprintf( |
|
91 | - esc_html__( |
|
92 | - 'Controls whether the Event Espresso Event Editor continues to use the existing legacy editor that functions like the typical older WordPress admin you are used to,%1$sor uses the new Advanced Editor with a more powerful and easier to use interface. This may be automatically turned on in order to utilize advanced features from new addons.', |
|
93 | - 'event_espresso' |
|
94 | - ), |
|
95 | - '<br />' |
|
96 | - ), |
|
97 | - ] |
|
98 | - ) |
|
99 | - ), |
|
100 | - 'defaults_section_header' => new EE_Form_Section_HTML( |
|
101 | - EEH_HTML::h2( |
|
102 | - esc_html__('Default Settings', 'event_espresso'), |
|
103 | - '', |
|
104 | - 'ee-admin-settings-hdr' |
|
105 | - ) |
|
106 | - ), |
|
107 | - ] + $default_event_settings_form_subsections; |
|
108 | - } |
|
69 | + /** |
|
70 | + * @param array $default_event_settings_form_subsections |
|
71 | + * @return array |
|
72 | + * @since $VID:$ |
|
73 | + */ |
|
74 | + public function mergeFormSubsections(array $default_event_settings_form_subsections) |
|
75 | + { |
|
76 | + return [ |
|
77 | + 'use_advanced_editor' => new EE_Select_Input( |
|
78 | + apply_filters( |
|
79 | + 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_answer_options', |
|
80 | + [ |
|
81 | + esc_html__('Legacy Editor', 'event_espresso'), |
|
82 | + esc_html__('Advanced Editor', 'event_espresso'), |
|
83 | + ] |
|
84 | + ), |
|
85 | + apply_filters( |
|
86 | + 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_settings', |
|
87 | + [ |
|
88 | + 'default' => $this->admin_config->useAdvancedEditor(), |
|
89 | + 'html_label_text' => esc_html__('Activate Advanced Editor?', 'event_espresso'), |
|
90 | + 'html_help_text' => sprintf( |
|
91 | + esc_html__( |
|
92 | + 'Controls whether the Event Espresso Event Editor continues to use the existing legacy editor that functions like the typical older WordPress admin you are used to,%1$sor uses the new Advanced Editor with a more powerful and easier to use interface. This may be automatically turned on in order to utilize advanced features from new addons.', |
|
93 | + 'event_espresso' |
|
94 | + ), |
|
95 | + '<br />' |
|
96 | + ), |
|
97 | + ] |
|
98 | + ) |
|
99 | + ), |
|
100 | + 'defaults_section_header' => new EE_Form_Section_HTML( |
|
101 | + EEH_HTML::h2( |
|
102 | + esc_html__('Default Settings', 'event_espresso'), |
|
103 | + '', |
|
104 | + 'ee-admin-settings-hdr' |
|
105 | + ) |
|
106 | + ), |
|
107 | + ] + $default_event_settings_form_subsections; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | |
111 | - /** |
|
112 | - * @param array $valid_data |
|
113 | - * @param EE_Config $config |
|
114 | - * @since $VID:$ |
|
115 | - */ |
|
116 | - public function updateAdminFormSettings(array $valid_data, EE_Config $config) |
|
117 | - { |
|
118 | - $config->admin->setUseAdvancedEditor( |
|
119 | - isset($valid_data['use_advanced_editor']) |
|
120 | - ? $valid_data['use_advanced_editor'] |
|
121 | - : false |
|
122 | - ); |
|
123 | - } |
|
111 | + /** |
|
112 | + * @param array $valid_data |
|
113 | + * @param EE_Config $config |
|
114 | + * @since $VID:$ |
|
115 | + */ |
|
116 | + public function updateAdminFormSettings(array $valid_data, EE_Config $config) |
|
117 | + { |
|
118 | + $config->admin->setUseAdvancedEditor( |
|
119 | + isset($valid_data['use_advanced_editor']) |
|
120 | + ? $valid_data['use_advanced_editor'] |
|
121 | + : false |
|
122 | + ); |
|
123 | + } |
|
124 | 124 | } |