@@ -15,87 +15,87 @@ |
||
15 | 15 | */ |
16 | 16 | class Domain extends DomainBase implements CaffeinatedInterface |
17 | 17 | { |
18 | - /** |
|
19 | - * URL path component used to denote an API request |
|
20 | - */ |
|
21 | - const API_NAMESPACE = 'ee/v'; |
|
22 | - |
|
23 | - const ASSET_NAMESPACE = 'eventespresso'; |
|
24 | - |
|
25 | - const TEXT_DOMAIN = 'event_espresso'; |
|
26 | - |
|
27 | - /** |
|
28 | - * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin |
|
29 | - * Page ui. |
|
30 | - */ |
|
31 | - const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN |
|
32 | - = 'manual_registration_status_change_from_registration_admin'; |
|
33 | - |
|
34 | - const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY |
|
35 | - = 'manual_registration_status_change_from_registration_admin_and_notify'; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * Whether or not EE core is the full premium version. |
|
40 | - * @since 4.9.59.p |
|
41 | - * @var bool |
|
42 | - */ |
|
43 | - private $caffeinated; |
|
44 | - |
|
45 | - /** |
|
46 | - * @since 5.0.0.p |
|
47 | - * @var bool |
|
48 | - */ |
|
49 | - private $multisite; |
|
50 | - |
|
51 | - |
|
52 | - public function __construct(FilePath $plugin_file, Version $version) |
|
53 | - { |
|
54 | - parent::__construct($plugin_file, $version); |
|
55 | - $this->setCaffeinated(); |
|
56 | - $this->multisite = is_multisite(); |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * Whether or not EE core is the full premium version. |
|
61 | - * @since 4.9.59.p |
|
62 | - * @return bool |
|
63 | - */ |
|
64 | - public function isCaffeinated() |
|
65 | - { |
|
66 | - return $this->caffeinated; |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Setter for $is_caffeinated property. |
|
72 | - * @since 4.9.59.p |
|
73 | - */ |
|
74 | - private function setCaffeinated() |
|
75 | - { |
|
76 | - $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true) |
|
77 | - && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php'); |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces |
|
83 | - * to allow for filtering the brand. |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public static function brandName() |
|
88 | - { |
|
89 | - return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso'); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @return bool |
|
95 | - * @since 5.0.0.p |
|
96 | - */ |
|
97 | - public function isMultiSite(): bool |
|
98 | - { |
|
99 | - return $this->multisite; |
|
100 | - } |
|
18 | + /** |
|
19 | + * URL path component used to denote an API request |
|
20 | + */ |
|
21 | + const API_NAMESPACE = 'ee/v'; |
|
22 | + |
|
23 | + const ASSET_NAMESPACE = 'eventespresso'; |
|
24 | + |
|
25 | + const TEXT_DOMAIN = 'event_espresso'; |
|
26 | + |
|
27 | + /** |
|
28 | + * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin |
|
29 | + * Page ui. |
|
30 | + */ |
|
31 | + const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN |
|
32 | + = 'manual_registration_status_change_from_registration_admin'; |
|
33 | + |
|
34 | + const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY |
|
35 | + = 'manual_registration_status_change_from_registration_admin_and_notify'; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * Whether or not EE core is the full premium version. |
|
40 | + * @since 4.9.59.p |
|
41 | + * @var bool |
|
42 | + */ |
|
43 | + private $caffeinated; |
|
44 | + |
|
45 | + /** |
|
46 | + * @since 5.0.0.p |
|
47 | + * @var bool |
|
48 | + */ |
|
49 | + private $multisite; |
|
50 | + |
|
51 | + |
|
52 | + public function __construct(FilePath $plugin_file, Version $version) |
|
53 | + { |
|
54 | + parent::__construct($plugin_file, $version); |
|
55 | + $this->setCaffeinated(); |
|
56 | + $this->multisite = is_multisite(); |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * Whether or not EE core is the full premium version. |
|
61 | + * @since 4.9.59.p |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | + public function isCaffeinated() |
|
65 | + { |
|
66 | + return $this->caffeinated; |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Setter for $is_caffeinated property. |
|
72 | + * @since 4.9.59.p |
|
73 | + */ |
|
74 | + private function setCaffeinated() |
|
75 | + { |
|
76 | + $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true) |
|
77 | + && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php'); |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces |
|
83 | + * to allow for filtering the brand. |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public static function brandName() |
|
88 | + { |
|
89 | + return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso'); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @return bool |
|
95 | + * @since 5.0.0.p |
|
96 | + */ |
|
97 | + public function isMultiSite(): bool |
|
98 | + { |
|
99 | + return $this->multisite; |
|
100 | + } |
|
101 | 101 | } |
@@ -21,125 +21,125 @@ |
||
21 | 21 | */ |
22 | 22 | class DatetimeToJson implements ModelObjectToJsonConverterInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * @param EE_Datetime[] $datetimes |
|
26 | - * @return array |
|
27 | - * @throws EE_Error |
|
28 | - * @throws InvalidArgumentException |
|
29 | - * @throws InvalidDataTypeException |
|
30 | - * @throws InvalidInterfaceException |
|
31 | - * @throws ReflectionException |
|
32 | - * @since 5.0.0.p |
|
33 | - */ |
|
34 | - public function convertAndEncodeArrayOf(array $datetimes) |
|
35 | - { |
|
36 | - $jsonDates = []; |
|
37 | - foreach ($datetimes as $datetime) { |
|
38 | - if ($datetime instanceof EE_Datetime) { |
|
39 | - $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime); |
|
40 | - } |
|
41 | - } |
|
42 | - return $jsonDates; |
|
43 | - } |
|
24 | + /** |
|
25 | + * @param EE_Datetime[] $datetimes |
|
26 | + * @return array |
|
27 | + * @throws EE_Error |
|
28 | + * @throws InvalidArgumentException |
|
29 | + * @throws InvalidDataTypeException |
|
30 | + * @throws InvalidInterfaceException |
|
31 | + * @throws ReflectionException |
|
32 | + * @since 5.0.0.p |
|
33 | + */ |
|
34 | + public function convertAndEncodeArrayOf(array $datetimes) |
|
35 | + { |
|
36 | + $jsonDates = []; |
|
37 | + foreach ($datetimes as $datetime) { |
|
38 | + if ($datetime instanceof EE_Datetime) { |
|
39 | + $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime); |
|
40 | + } |
|
41 | + } |
|
42 | + return $jsonDates; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @param EE_Datetime $datetime |
|
48 | - * @return false|string |
|
49 | - * @throws EE_Error |
|
50 | - * @throws InvalidArgumentException |
|
51 | - * @throws InvalidDataTypeException |
|
52 | - * @throws InvalidInterfaceException |
|
53 | - * @throws ReflectionException |
|
54 | - * @since 5.0.0.p |
|
55 | - */ |
|
56 | - public function convertAndEncode($datetime) |
|
57 | - { |
|
58 | - return $datetime instanceof EE_Datetime ? $this->encode($this->convert($datetime)) : false; |
|
59 | - } |
|
46 | + /** |
|
47 | + * @param EE_Datetime $datetime |
|
48 | + * @return false|string |
|
49 | + * @throws EE_Error |
|
50 | + * @throws InvalidArgumentException |
|
51 | + * @throws InvalidDataTypeException |
|
52 | + * @throws InvalidInterfaceException |
|
53 | + * @throws ReflectionException |
|
54 | + * @since 5.0.0.p |
|
55 | + */ |
|
56 | + public function convertAndEncode($datetime) |
|
57 | + { |
|
58 | + return $datetime instanceof EE_Datetime ? $this->encode($this->convert($datetime)) : false; |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * @param EE_Datetime[] $datetimes |
|
64 | - * @return array |
|
65 | - * @throws EE_Error |
|
66 | - * @throws InvalidArgumentException |
|
67 | - * @throws InvalidDataTypeException |
|
68 | - * @throws InvalidInterfaceException |
|
69 | - * @throws ReflectionException |
|
70 | - * @since 5.0.0.p |
|
71 | - */ |
|
72 | - public function convertArrayOf(array $datetimes) |
|
73 | - { |
|
74 | - $arrayOfDates = []; |
|
75 | - foreach ($datetimes as $datetime) { |
|
76 | - if ($datetime instanceof EE_Datetime) { |
|
77 | - $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime); |
|
78 | - } |
|
79 | - } |
|
80 | - return $arrayOfDates; |
|
81 | - } |
|
62 | + /** |
|
63 | + * @param EE_Datetime[] $datetimes |
|
64 | + * @return array |
|
65 | + * @throws EE_Error |
|
66 | + * @throws InvalidArgumentException |
|
67 | + * @throws InvalidDataTypeException |
|
68 | + * @throws InvalidInterfaceException |
|
69 | + * @throws ReflectionException |
|
70 | + * @since 5.0.0.p |
|
71 | + */ |
|
72 | + public function convertArrayOf(array $datetimes) |
|
73 | + { |
|
74 | + $arrayOfDates = []; |
|
75 | + foreach ($datetimes as $datetime) { |
|
76 | + if ($datetime instanceof EE_Datetime) { |
|
77 | + $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime); |
|
78 | + } |
|
79 | + } |
|
80 | + return $arrayOfDates; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | - /** |
|
85 | - * @param EE_Datetime $datetime |
|
86 | - * @return array |
|
87 | - * @throws EE_Error |
|
88 | - * @throws InvalidDataTypeException |
|
89 | - * @throws InvalidInterfaceException |
|
90 | - * @throws InvalidArgumentException |
|
91 | - * @throws ReflectionException |
|
92 | - * @since 5.0.0.p |
|
93 | - */ |
|
94 | - public function convert($datetime) |
|
95 | - { |
|
96 | - return $datetime instanceof EE_Datetime ? [ |
|
97 | - 'DTT_ID' => $datetime->ID(), |
|
98 | - 'EVT_ID' => $datetime->event() instanceof EE_Event ? $datetime->event()->ID() : 0, |
|
99 | - 'DTT_name' => $datetime->name(), |
|
100 | - 'DTT_description' => $datetime->description(), |
|
101 | - 'DTT_EVT_start' => $datetime->start_date(DATE_ATOM), |
|
102 | - 'DTT_EVT_end' => $datetime->end_date(DATE_ATOM), |
|
103 | - 'DTT_sold' => $datetime->sold(), |
|
104 | - 'DTT_reserved' => $datetime->reserved(), |
|
105 | - 'DTT_reg_limit' => $datetime->reg_limit() === INF ? -1 : $datetime->reg_limit(), |
|
106 | - 'DTT_is_primary' => $datetime->get_active_status(), |
|
107 | - 'DTT_order' => $datetime->order(), |
|
108 | - 'DTT_parent' => $datetime->parent(), |
|
109 | - 'DTT_deleted' => $datetime->get('DTT_deleted'), |
|
110 | - ] : []; |
|
111 | - } |
|
84 | + /** |
|
85 | + * @param EE_Datetime $datetime |
|
86 | + * @return array |
|
87 | + * @throws EE_Error |
|
88 | + * @throws InvalidDataTypeException |
|
89 | + * @throws InvalidInterfaceException |
|
90 | + * @throws InvalidArgumentException |
|
91 | + * @throws ReflectionException |
|
92 | + * @since 5.0.0.p |
|
93 | + */ |
|
94 | + public function convert($datetime) |
|
95 | + { |
|
96 | + return $datetime instanceof EE_Datetime ? [ |
|
97 | + 'DTT_ID' => $datetime->ID(), |
|
98 | + 'EVT_ID' => $datetime->event() instanceof EE_Event ? $datetime->event()->ID() : 0, |
|
99 | + 'DTT_name' => $datetime->name(), |
|
100 | + 'DTT_description' => $datetime->description(), |
|
101 | + 'DTT_EVT_start' => $datetime->start_date(DATE_ATOM), |
|
102 | + 'DTT_EVT_end' => $datetime->end_date(DATE_ATOM), |
|
103 | + 'DTT_sold' => $datetime->sold(), |
|
104 | + 'DTT_reserved' => $datetime->reserved(), |
|
105 | + 'DTT_reg_limit' => $datetime->reg_limit() === INF ? -1 : $datetime->reg_limit(), |
|
106 | + 'DTT_is_primary' => $datetime->get_active_status(), |
|
107 | + 'DTT_order' => $datetime->order(), |
|
108 | + 'DTT_parent' => $datetime->parent(), |
|
109 | + 'DTT_deleted' => $datetime->get('DTT_deleted'), |
|
110 | + ] : []; |
|
111 | + } |
|
112 | 112 | |
113 | 113 | |
114 | - /** |
|
115 | - * @param EE_Datetime[] $datetimes |
|
116 | - * @return array |
|
117 | - * @throws EE_Error |
|
118 | - * @throws InvalidArgumentException |
|
119 | - * @throws InvalidDataTypeException |
|
120 | - * @throws InvalidInterfaceException |
|
121 | - * @throws ReflectionException |
|
122 | - * @since 5.0.0.p |
|
123 | - */ |
|
124 | - public function encodeArrayOf(array $datetimes) |
|
125 | - { |
|
126 | - $jsonDates = []; |
|
127 | - foreach ($datetimes as $datetime) { |
|
128 | - if ($datetime instanceof EE_Datetime) { |
|
129 | - $jsonDates[ $datetime->ID() ] = $this->encode($datetime); |
|
130 | - } |
|
131 | - } |
|
132 | - return $jsonDates; |
|
133 | - } |
|
114 | + /** |
|
115 | + * @param EE_Datetime[] $datetimes |
|
116 | + * @return array |
|
117 | + * @throws EE_Error |
|
118 | + * @throws InvalidArgumentException |
|
119 | + * @throws InvalidDataTypeException |
|
120 | + * @throws InvalidInterfaceException |
|
121 | + * @throws ReflectionException |
|
122 | + * @since 5.0.0.p |
|
123 | + */ |
|
124 | + public function encodeArrayOf(array $datetimes) |
|
125 | + { |
|
126 | + $jsonDates = []; |
|
127 | + foreach ($datetimes as $datetime) { |
|
128 | + if ($datetime instanceof EE_Datetime) { |
|
129 | + $jsonDates[ $datetime->ID() ] = $this->encode($datetime); |
|
130 | + } |
|
131 | + } |
|
132 | + return $jsonDates; |
|
133 | + } |
|
134 | 134 | |
135 | 135 | |
136 | - /** |
|
137 | - * @param array $datetime_array |
|
138 | - * @return false|string |
|
139 | - * @since 5.0.0.p |
|
140 | - */ |
|
141 | - public function encode(array $datetime_array) |
|
142 | - { |
|
143 | - return wp_json_encode($datetime_array); |
|
144 | - } |
|
136 | + /** |
|
137 | + * @param array $datetime_array |
|
138 | + * @return false|string |
|
139 | + * @since 5.0.0.p |
|
140 | + */ |
|
141 | + public function encode(array $datetime_array) |
|
142 | + { |
|
143 | + return wp_json_encode($datetime_array); |
|
144 | + } |
|
145 | 145 | } |
@@ -49,137 +49,137 @@ |
||
49 | 49 | */ |
50 | 50 | class RestApiSpoofer |
51 | 51 | { |
52 | - /** |
|
53 | - * @var WP_REST_Server $wp_rest_server |
|
54 | - */ |
|
55 | - protected $wp_rest_server; |
|
52 | + /** |
|
53 | + * @var WP_REST_Server $wp_rest_server |
|
54 | + */ |
|
55 | + protected $wp_rest_server; |
|
56 | 56 | |
57 | - /** |
|
58 | - * @var Read |
|
59 | - */ |
|
60 | - protected $rest_controller; |
|
57 | + /** |
|
58 | + * @var Read |
|
59 | + */ |
|
60 | + protected $rest_controller; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @var EED_Core_Rest_Api $rest_module |
|
64 | - */ |
|
65 | - protected $rest_module; |
|
62 | + /** |
|
63 | + * @var EED_Core_Rest_Api $rest_module |
|
64 | + */ |
|
65 | + protected $rest_module; |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * RestApiSpoofer constructor. |
|
70 | - * |
|
71 | - * @param WP_REST_Server $wp_rest_server |
|
72 | - * @param EED_Core_Rest_Api $rest_module |
|
73 | - * @param Read $rest_api |
|
74 | - * @param string $api_version |
|
75 | - */ |
|
76 | - public function __construct( |
|
77 | - WP_REST_Server $wp_rest_server, |
|
78 | - EED_Core_Rest_Api $rest_module, |
|
79 | - Read $rest_api, |
|
80 | - $api_version = '4.8.36' |
|
81 | - ) { |
|
82 | - $this->wp_rest_server = $wp_rest_server; |
|
83 | - $this->rest_module = $rest_module; |
|
84 | - $this->rest_controller = $rest_api; |
|
85 | - $this->rest_controller->setRequestedVersion($api_version); |
|
86 | - $this->setUpRestServer(); |
|
87 | - } |
|
68 | + /** |
|
69 | + * RestApiSpoofer constructor. |
|
70 | + * |
|
71 | + * @param WP_REST_Server $wp_rest_server |
|
72 | + * @param EED_Core_Rest_Api $rest_module |
|
73 | + * @param Read $rest_api |
|
74 | + * @param string $api_version |
|
75 | + */ |
|
76 | + public function __construct( |
|
77 | + WP_REST_Server $wp_rest_server, |
|
78 | + EED_Core_Rest_Api $rest_module, |
|
79 | + Read $rest_api, |
|
80 | + $api_version = '4.8.36' |
|
81 | + ) { |
|
82 | + $this->wp_rest_server = $wp_rest_server; |
|
83 | + $this->rest_module = $rest_module; |
|
84 | + $this->rest_controller = $rest_api; |
|
85 | + $this->rest_controller->setRequestedVersion($api_version); |
|
86 | + $this->setUpRestServer(); |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - private function setUpRestServer() |
|
91 | - { |
|
92 | - /* @var WP_REST_Server $wp_rest_server */ |
|
93 | - global $wp_rest_server; |
|
94 | - $wp_rest_server = $this->wp_rest_server; |
|
95 | - EED_Core_Rest_Api::set_hooks_both(); |
|
96 | - do_action('rest_api_init', $this->wp_rest_server); |
|
97 | - } |
|
90 | + private function setUpRestServer() |
|
91 | + { |
|
92 | + /* @var WP_REST_Server $wp_rest_server */ |
|
93 | + global $wp_rest_server; |
|
94 | + $wp_rest_server = $this->wp_rest_server; |
|
95 | + EED_Core_Rest_Api::set_hooks_both(); |
|
96 | + do_action('rest_api_init', $this->wp_rest_server); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @param EEM_Base $model |
|
101 | - * @param array $query_params |
|
102 | - * @param string $include |
|
103 | - * @return array |
|
104 | - * @throws EE_Error |
|
105 | - * @throws InvalidArgumentException |
|
106 | - * @throws InvalidDataTypeException |
|
107 | - * @throws InvalidInterfaceException |
|
108 | - * @throws ModelConfigurationException |
|
109 | - * @throws ReflectionException |
|
110 | - * @throws RestException |
|
111 | - * @throws RestPasswordIncorrectException |
|
112 | - * @throws RestPasswordRequiredException |
|
113 | - * @throws UnexpectedEntityException |
|
114 | - * @throws DomainException |
|
115 | - * @since 5.0.0.p |
|
116 | - */ |
|
117 | - public function getOneApiResult(EEM_Base $model, array $query_params, $include = '') |
|
118 | - { |
|
119 | - if (! array_key_exists('limit', $query_params)) { |
|
120 | - $query_params['limit'] = 1; |
|
121 | - } |
|
122 | - $result = $this->getApiResults($model, $query_params, $include); |
|
123 | - return is_array($result) && isset($result[0]) ? $result[0] : []; |
|
124 | - } |
|
99 | + /** |
|
100 | + * @param EEM_Base $model |
|
101 | + * @param array $query_params |
|
102 | + * @param string $include |
|
103 | + * @return array |
|
104 | + * @throws EE_Error |
|
105 | + * @throws InvalidArgumentException |
|
106 | + * @throws InvalidDataTypeException |
|
107 | + * @throws InvalidInterfaceException |
|
108 | + * @throws ModelConfigurationException |
|
109 | + * @throws ReflectionException |
|
110 | + * @throws RestException |
|
111 | + * @throws RestPasswordIncorrectException |
|
112 | + * @throws RestPasswordRequiredException |
|
113 | + * @throws UnexpectedEntityException |
|
114 | + * @throws DomainException |
|
115 | + * @since 5.0.0.p |
|
116 | + */ |
|
117 | + public function getOneApiResult(EEM_Base $model, array $query_params, $include = '') |
|
118 | + { |
|
119 | + if (! array_key_exists('limit', $query_params)) { |
|
120 | + $query_params['limit'] = 1; |
|
121 | + } |
|
122 | + $result = $this->getApiResults($model, $query_params, $include); |
|
123 | + return is_array($result) && isset($result[0]) ? $result[0] : []; |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * @param EEM_Base $model |
|
128 | - * @param array $query_params |
|
129 | - * @param string $include |
|
130 | - * @return array |
|
131 | - * @throws EE_Error |
|
132 | - * @throws InvalidArgumentException |
|
133 | - * @throws InvalidDataTypeException |
|
134 | - * @throws InvalidInterfaceException |
|
135 | - * @throws ModelConfigurationException |
|
136 | - * @throws ReflectionException |
|
137 | - * @throws RestException |
|
138 | - * @throws RestPasswordIncorrectException |
|
139 | - * @throws RestPasswordRequiredException |
|
140 | - * @throws UnexpectedEntityException |
|
141 | - * @throws DomainException |
|
142 | - * @since 5.0.0.p |
|
143 | - */ |
|
144 | - public function getApiResults(EEM_Base $model, array $query_params, $include = '') |
|
145 | - { |
|
146 | - if (! array_key_exists('caps', $query_params)) { |
|
147 | - $query_params['caps'] = EEM_Base::caps_read_admin; |
|
148 | - } |
|
149 | - if (! array_key_exists('default_where_conditions', $query_params)) { |
|
150 | - $query_params['default_where_conditions'] = 'none'; |
|
151 | - } |
|
152 | - /** @type array $results */ |
|
153 | - $results = $model->get_all_wpdb_results($query_params); |
|
154 | - $rest_request = new WP_REST_Request(); |
|
155 | - $rest_request->set_param('include', $include); |
|
156 | - $rest_request->set_param('caps', 'edit'); |
|
157 | - $nice_results = array(); |
|
158 | - foreach ($results as $result) { |
|
159 | - $nice_results[] = $this->rest_controller->createEntityFromWpdbResult( |
|
160 | - $model, |
|
161 | - $result, |
|
162 | - $rest_request |
|
163 | - ); |
|
164 | - } |
|
165 | - return $nice_results; |
|
166 | - } |
|
126 | + /** |
|
127 | + * @param EEM_Base $model |
|
128 | + * @param array $query_params |
|
129 | + * @param string $include |
|
130 | + * @return array |
|
131 | + * @throws EE_Error |
|
132 | + * @throws InvalidArgumentException |
|
133 | + * @throws InvalidDataTypeException |
|
134 | + * @throws InvalidInterfaceException |
|
135 | + * @throws ModelConfigurationException |
|
136 | + * @throws ReflectionException |
|
137 | + * @throws RestException |
|
138 | + * @throws RestPasswordIncorrectException |
|
139 | + * @throws RestPasswordRequiredException |
|
140 | + * @throws UnexpectedEntityException |
|
141 | + * @throws DomainException |
|
142 | + * @since 5.0.0.p |
|
143 | + */ |
|
144 | + public function getApiResults(EEM_Base $model, array $query_params, $include = '') |
|
145 | + { |
|
146 | + if (! array_key_exists('caps', $query_params)) { |
|
147 | + $query_params['caps'] = EEM_Base::caps_read_admin; |
|
148 | + } |
|
149 | + if (! array_key_exists('default_where_conditions', $query_params)) { |
|
150 | + $query_params['default_where_conditions'] = 'none'; |
|
151 | + } |
|
152 | + /** @type array $results */ |
|
153 | + $results = $model->get_all_wpdb_results($query_params); |
|
154 | + $rest_request = new WP_REST_Request(); |
|
155 | + $rest_request->set_param('include', $include); |
|
156 | + $rest_request->set_param('caps', 'edit'); |
|
157 | + $nice_results = array(); |
|
158 | + foreach ($results as $result) { |
|
159 | + $nice_results[] = $this->rest_controller->createEntityFromWpdbResult( |
|
160 | + $model, |
|
161 | + $result, |
|
162 | + $rest_request |
|
163 | + ); |
|
164 | + } |
|
165 | + return $nice_results; |
|
166 | + } |
|
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * @param string $endpoint |
|
171 | - * @return array |
|
172 | - * @throws EE_Error |
|
173 | - * @since 5.0.0.p |
|
174 | - */ |
|
175 | - public function getModelSchema($endpoint) |
|
176 | - { |
|
177 | - $response = $this->wp_rest_server->dispatch( |
|
178 | - new WP_REST_Request( |
|
179 | - 'OPTIONS', |
|
180 | - "/ee/v4.8.36/{$endpoint}" |
|
181 | - ) |
|
182 | - ); |
|
183 | - return $response->get_data(); |
|
184 | - } |
|
169 | + /** |
|
170 | + * @param string $endpoint |
|
171 | + * @return array |
|
172 | + * @throws EE_Error |
|
173 | + * @since 5.0.0.p |
|
174 | + */ |
|
175 | + public function getModelSchema($endpoint) |
|
176 | + { |
|
177 | + $response = $this->wp_rest_server->dispatch( |
|
178 | + new WP_REST_Request( |
|
179 | + 'OPTIONS', |
|
180 | + "/ee/v4.8.36/{$endpoint}" |
|
181 | + ) |
|
182 | + ); |
|
183 | + return $response->get_data(); |
|
184 | + } |
|
185 | 185 | } |
@@ -27,58 +27,58 @@ |
||
27 | 27 | */ |
28 | 28 | class RestApiSpoofer |
29 | 29 | { |
30 | - /** |
|
31 | - * @var Read |
|
32 | - */ |
|
33 | - protected $rest_api; |
|
30 | + /** |
|
31 | + * @var Read |
|
32 | + */ |
|
33 | + protected $rest_api; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * RestApiSpoofer constructor. |
|
38 | - * |
|
39 | - * @param Read $rest_api |
|
40 | - * @param string $api_version |
|
41 | - */ |
|
42 | - public function __construct(Read $rest_api, $api_version = '4.8.36') |
|
43 | - { |
|
44 | - $this->rest_api = $rest_api; |
|
45 | - $this->rest_api->setRequestedVersion($api_version); |
|
46 | - } |
|
36 | + /** |
|
37 | + * RestApiSpoofer constructor. |
|
38 | + * |
|
39 | + * @param Read $rest_api |
|
40 | + * @param string $api_version |
|
41 | + */ |
|
42 | + public function __construct(Read $rest_api, $api_version = '4.8.36') |
|
43 | + { |
|
44 | + $this->rest_api = $rest_api; |
|
45 | + $this->rest_api->setRequestedVersion($api_version); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * @param EEM_Base $model |
|
51 | - * @param array $query_params |
|
52 | - * @param string $include |
|
53 | - * @return array |
|
54 | - * @throws EE_Error |
|
55 | - * @throws InvalidArgumentException |
|
56 | - * @throws InvalidDataTypeException |
|
57 | - * @throws InvalidInterfaceException |
|
58 | - * @throws ModelConfigurationException |
|
59 | - * @throws ReflectionException |
|
60 | - * @throws RestException |
|
61 | - * @throws RestPasswordIncorrectException |
|
62 | - * @throws RestPasswordRequiredException |
|
63 | - * @throws UnexpectedEntityException |
|
64 | - * @throws DomainException |
|
65 | - * @since 5.0.0.p |
|
66 | - */ |
|
67 | - public function getApiResults(EEM_Base $model, array $query_params, $include = '') |
|
68 | - { |
|
69 | - /** @type array $results */ |
|
70 | - $results = $model->get_all_wpdb_results($query_params); |
|
71 | - $rest_request = new WP_REST_Request(); |
|
72 | - $rest_request->set_param('include', $include); |
|
73 | - $rest_request->set_param('caps', 'edit'); |
|
74 | - $nice_results = array(); |
|
75 | - foreach ($results as $result) { |
|
76 | - $nice_results[] = $this->rest_api->createEntityFromWpdbResult( |
|
77 | - $model, |
|
78 | - $result, |
|
79 | - $rest_request |
|
80 | - ); |
|
81 | - } |
|
82 | - return $nice_results; |
|
83 | - } |
|
49 | + /** |
|
50 | + * @param EEM_Base $model |
|
51 | + * @param array $query_params |
|
52 | + * @param string $include |
|
53 | + * @return array |
|
54 | + * @throws EE_Error |
|
55 | + * @throws InvalidArgumentException |
|
56 | + * @throws InvalidDataTypeException |
|
57 | + * @throws InvalidInterfaceException |
|
58 | + * @throws ModelConfigurationException |
|
59 | + * @throws ReflectionException |
|
60 | + * @throws RestException |
|
61 | + * @throws RestPasswordIncorrectException |
|
62 | + * @throws RestPasswordRequiredException |
|
63 | + * @throws UnexpectedEntityException |
|
64 | + * @throws DomainException |
|
65 | + * @since 5.0.0.p |
|
66 | + */ |
|
67 | + public function getApiResults(EEM_Base $model, array $query_params, $include = '') |
|
68 | + { |
|
69 | + /** @type array $results */ |
|
70 | + $results = $model->get_all_wpdb_results($query_params); |
|
71 | + $rest_request = new WP_REST_Request(); |
|
72 | + $rest_request->set_param('include', $include); |
|
73 | + $rest_request->set_param('caps', 'edit'); |
|
74 | + $nice_results = array(); |
|
75 | + foreach ($results as $result) { |
|
76 | + $nice_results[] = $this->rest_api->createEntityFromWpdbResult( |
|
77 | + $model, |
|
78 | + $result, |
|
79 | + $rest_request |
|
80 | + ); |
|
81 | + } |
|
82 | + return $nice_results; |
|
83 | + } |
|
84 | 84 | } |
@@ -29,130 +29,130 @@ |
||
29 | 29 | */ |
30 | 30 | class NewEventDefaultEntities extends EventEditorData |
31 | 31 | { |
32 | - /** |
|
33 | - * @var DefaultDatetimes |
|
34 | - */ |
|
35 | - protected $default_datetimes; |
|
32 | + /** |
|
33 | + * @var DefaultDatetimes |
|
34 | + */ |
|
35 | + protected $default_datetimes; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var DefaultFormSections |
|
39 | - */ |
|
40 | - protected $default_form_sections; |
|
37 | + /** |
|
38 | + * @var DefaultFormSections |
|
39 | + */ |
|
40 | + protected $default_form_sections; |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * NewEventDefaultEntities constructor. |
|
45 | - * |
|
46 | - * @param DefaultDatetimes $default_datetimes |
|
47 | - * @param DefaultFormSections $default_form_sections |
|
48 | - * @param EEM_Datetime $datetime_model |
|
49 | - * @param EEM_Event $event_model |
|
50 | - * @param EEM_Price $price_model |
|
51 | - * @param EEM_Price_Type $price_type_model |
|
52 | - * @param EEM_Ticket $ticket_model |
|
53 | - * @param Utilities $utilities |
|
54 | - */ |
|
55 | - public function __construct( |
|
56 | - DefaultDatetimes $default_datetimes, |
|
57 | - DefaultFormSections $default_form_sections, |
|
58 | - EEM_Datetime $datetime_model, |
|
59 | - EEM_Event $event_model, |
|
60 | - EEM_Price $price_model, |
|
61 | - EEM_Price_Type $price_type_model, |
|
62 | - EEM_Ticket $ticket_model, |
|
63 | - Utilities $utilities |
|
64 | - ) { |
|
65 | - $this->default_datetimes = $default_datetimes; |
|
66 | - $this->default_form_sections = $default_form_sections; |
|
67 | - parent::__construct( |
|
68 | - $datetime_model, |
|
69 | - $event_model, |
|
70 | - $price_model, |
|
71 | - $price_type_model, |
|
72 | - $ticket_model, |
|
73 | - $utilities |
|
74 | - ); |
|
75 | - } |
|
43 | + /** |
|
44 | + * NewEventDefaultEntities constructor. |
|
45 | + * |
|
46 | + * @param DefaultDatetimes $default_datetimes |
|
47 | + * @param DefaultFormSections $default_form_sections |
|
48 | + * @param EEM_Datetime $datetime_model |
|
49 | + * @param EEM_Event $event_model |
|
50 | + * @param EEM_Price $price_model |
|
51 | + * @param EEM_Price_Type $price_type_model |
|
52 | + * @param EEM_Ticket $ticket_model |
|
53 | + * @param Utilities $utilities |
|
54 | + */ |
|
55 | + public function __construct( |
|
56 | + DefaultDatetimes $default_datetimes, |
|
57 | + DefaultFormSections $default_form_sections, |
|
58 | + EEM_Datetime $datetime_model, |
|
59 | + EEM_Event $event_model, |
|
60 | + EEM_Price $price_model, |
|
61 | + EEM_Price_Type $price_type_model, |
|
62 | + EEM_Ticket $ticket_model, |
|
63 | + Utilities $utilities |
|
64 | + ) { |
|
65 | + $this->default_datetimes = $default_datetimes; |
|
66 | + $this->default_form_sections = $default_form_sections; |
|
67 | + parent::__construct( |
|
68 | + $datetime_model, |
|
69 | + $event_model, |
|
70 | + $price_model, |
|
71 | + $price_type_model, |
|
72 | + $ticket_model, |
|
73 | + $utilities |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @param int $eventId |
|
80 | - * @return EE_Datetime[] |
|
81 | - * @throws EE_Error |
|
82 | - * @throws InvalidArgumentException |
|
83 | - * @throws InvalidEntityException |
|
84 | - * @throws ReflectionException |
|
85 | - * @since 5.0.0.p |
|
86 | - */ |
|
87 | - public function getData(int $eventId): array |
|
88 | - { |
|
89 | - $EVT_ID = absint($eventId); |
|
90 | - if ($EVT_ID < 1) { |
|
91 | - throw new InvalidArgumentException( |
|
92 | - esc_html__( |
|
93 | - 'A missing or invalid event ID was received.', |
|
94 | - 'event_espresso' |
|
95 | - ) |
|
96 | - ); |
|
97 | - } |
|
98 | - $event = $this->event_model->get_one_by_ID($EVT_ID); |
|
99 | - if (! $event instanceof EE_Event) { |
|
100 | - throw new InvalidEntityException($event, 'EE_Event'); |
|
101 | - } |
|
102 | - $new_event = isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new'; |
|
103 | - return [ |
|
104 | - 'datetimes' => $this->createDefaultDatetimes($event, $new_event), |
|
105 | - 'form_sections' => $this->createDefaultFormSections($event, $new_event), |
|
106 | - ]; |
|
107 | - } |
|
78 | + /** |
|
79 | + * @param int $eventId |
|
80 | + * @return EE_Datetime[] |
|
81 | + * @throws EE_Error |
|
82 | + * @throws InvalidArgumentException |
|
83 | + * @throws InvalidEntityException |
|
84 | + * @throws ReflectionException |
|
85 | + * @since 5.0.0.p |
|
86 | + */ |
|
87 | + public function getData(int $eventId): array |
|
88 | + { |
|
89 | + $EVT_ID = absint($eventId); |
|
90 | + if ($EVT_ID < 1) { |
|
91 | + throw new InvalidArgumentException( |
|
92 | + esc_html__( |
|
93 | + 'A missing or invalid event ID was received.', |
|
94 | + 'event_espresso' |
|
95 | + ) |
|
96 | + ); |
|
97 | + } |
|
98 | + $event = $this->event_model->get_one_by_ID($EVT_ID); |
|
99 | + if (! $event instanceof EE_Event) { |
|
100 | + throw new InvalidEntityException($event, 'EE_Event'); |
|
101 | + } |
|
102 | + $new_event = isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new'; |
|
103 | + return [ |
|
104 | + 'datetimes' => $this->createDefaultDatetimes($event, $new_event), |
|
105 | + 'form_sections' => $this->createDefaultFormSections($event, $new_event), |
|
106 | + ]; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * @param EE_Event $event |
|
112 | - * @param bool $new_event |
|
113 | - * @return EE_Datetime[] |
|
114 | - * @throws EE_Error |
|
115 | - * @throws ReflectionException |
|
116 | - */ |
|
117 | - private function createDefaultDatetimes(EE_Event $event, bool $new_event): array |
|
118 | - { |
|
119 | - if ($new_event) { |
|
120 | - return $this->default_datetimes->create($event); |
|
121 | - } |
|
122 | - $datetime_count = $this->datetime_model->count( |
|
123 | - [ |
|
124 | - [ |
|
125 | - 'EVT_ID' => $event->ID(), |
|
126 | - 'DTT_deleted' => ['IN', [true, false]], |
|
127 | - ], |
|
128 | - 'default_where_conditions' => EEM_Base::default_where_conditions_none, |
|
129 | - ], |
|
130 | - 'EVT_ID' |
|
131 | - ); |
|
132 | - return $datetime_count === 0 |
|
133 | - ? $this->default_datetimes->create($event) |
|
134 | - : []; |
|
135 | - } |
|
110 | + /** |
|
111 | + * @param EE_Event $event |
|
112 | + * @param bool $new_event |
|
113 | + * @return EE_Datetime[] |
|
114 | + * @throws EE_Error |
|
115 | + * @throws ReflectionException |
|
116 | + */ |
|
117 | + private function createDefaultDatetimes(EE_Event $event, bool $new_event): array |
|
118 | + { |
|
119 | + if ($new_event) { |
|
120 | + return $this->default_datetimes->create($event); |
|
121 | + } |
|
122 | + $datetime_count = $this->datetime_model->count( |
|
123 | + [ |
|
124 | + [ |
|
125 | + 'EVT_ID' => $event->ID(), |
|
126 | + 'DTT_deleted' => ['IN', [true, false]], |
|
127 | + ], |
|
128 | + 'default_where_conditions' => EEM_Base::default_where_conditions_none, |
|
129 | + ], |
|
130 | + 'EVT_ID' |
|
131 | + ); |
|
132 | + return $datetime_count === 0 |
|
133 | + ? $this->default_datetimes->create($event) |
|
134 | + : []; |
|
135 | + } |
|
136 | 136 | |
137 | 137 | |
138 | - /** |
|
139 | - * if it's a new event and defaults have not been created yet, OR if there is no reg form at all... |
|
140 | - * |
|
141 | - * @param EE_Event $event |
|
142 | - * @param bool $new_event |
|
143 | - * @return EE_Form_Section[] |
|
144 | - * @throws EE_Error |
|
145 | - * @throws ReflectionException |
|
146 | - */ |
|
147 | - private function createDefaultFormSections(EE_Event $event, bool $new_event): array |
|
148 | - { |
|
149 | - if ($new_event) { |
|
150 | - return $this->default_form_sections->create($event); |
|
151 | - } |
|
152 | - $reg_form_UUID = $event->registrationFormUuid(); |
|
153 | - // if it's a new event and defaults have not been created yet, OR if there is no reg form at all... |
|
154 | - return ! $reg_form_UUID |
|
155 | - ? $this->default_form_sections->create($event) |
|
156 | - : []; |
|
157 | - } |
|
138 | + /** |
|
139 | + * if it's a new event and defaults have not been created yet, OR if there is no reg form at all... |
|
140 | + * |
|
141 | + * @param EE_Event $event |
|
142 | + * @param bool $new_event |
|
143 | + * @return EE_Form_Section[] |
|
144 | + * @throws EE_Error |
|
145 | + * @throws ReflectionException |
|
146 | + */ |
|
147 | + private function createDefaultFormSections(EE_Event $event, bool $new_event): array |
|
148 | + { |
|
149 | + if ($new_event) { |
|
150 | + return $this->default_form_sections->create($event); |
|
151 | + } |
|
152 | + $reg_form_UUID = $event->registrationFormUuid(); |
|
153 | + // if it's a new event and defaults have not been created yet, OR if there is no reg form at all... |
|
154 | + return ! $reg_form_UUID |
|
155 | + ? $this->default_form_sections->create($event) |
|
156 | + : []; |
|
157 | + } |
|
158 | 158 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | interface EventEditorDataInterface |
14 | 14 | { |
15 | - /** |
|
16 | - * @param int $eventId |
|
17 | - * @return array |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(int $eventId); |
|
15 | + /** |
|
16 | + * @param int $eventId |
|
17 | + * @return array |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(int $eventId); |
|
21 | 21 | } |
@@ -14,151 +14,151 @@ |
||
14 | 14 | */ |
15 | 15 | class EventEntityRelations extends EventEditorData |
16 | 16 | { |
17 | - /** |
|
18 | - * @param array $data |
|
19 | - */ |
|
20 | - private $data; |
|
17 | + /** |
|
18 | + * @param array $data |
|
19 | + */ |
|
20 | + private $data; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @param int $eventId |
|
24 | - * @return array |
|
25 | - * @throws EE_Error |
|
26 | - * @since 5.0.0.p |
|
27 | - */ |
|
28 | - public function getData(int $eventId): array |
|
29 | - { |
|
30 | - $this->data = [ |
|
31 | - 'datetimes' => [], |
|
32 | - 'tickets' => [], |
|
33 | - 'prices' => [], |
|
34 | - ]; |
|
22 | + /** |
|
23 | + * @param int $eventId |
|
24 | + * @return array |
|
25 | + * @throws EE_Error |
|
26 | + * @since 5.0.0.p |
|
27 | + */ |
|
28 | + public function getData(int $eventId): array |
|
29 | + { |
|
30 | + $this->data = [ |
|
31 | + 'datetimes' => [], |
|
32 | + 'tickets' => [], |
|
33 | + 'prices' => [], |
|
34 | + ]; |
|
35 | 35 | |
36 | - $datetimeIds = $this->processDatetimes($eventId); |
|
37 | - $ticketIds = $this->processTickets($datetimeIds); |
|
38 | - $this->processPrices($ticketIds); |
|
36 | + $datetimeIds = $this->processDatetimes($eventId); |
|
37 | + $ticketIds = $this->processTickets($datetimeIds); |
|
38 | + $this->processPrices($ticketIds); |
|
39 | 39 | |
40 | - return $this->data; |
|
41 | - } |
|
40 | + return $this->data; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * @param int $eventId |
|
46 | - * @return array |
|
47 | - * @throws EE_Error |
|
48 | - * @since 5.0.0.p |
|
49 | - */ |
|
50 | - private function processDatetimes(int $eventId): array |
|
51 | - { |
|
52 | - $related_models = [ |
|
53 | - 'tickets' => $this->ticket_model, |
|
54 | - ]; |
|
55 | - // Get the IDs of event datetimes. |
|
56 | - // SELECT Datetime.DTT_ID FROM wp_esp_datetime AS Datetime WHERE Datetime.EVT_ID = ## |
|
57 | - $datetimeIds = $this->datetime_model->get_col([ |
|
58 | - [ 'EVT_ID' => $eventId ], |
|
59 | - 'default_where_conditions' => 'minimum', |
|
60 | - ]); |
|
61 | - foreach ($datetimeIds as $datetimeId) { |
|
62 | - $GID = $this->utilities->convertToGlobalId($this->datetime_model->item_name(), $datetimeId); |
|
63 | - foreach ($related_models as $key => $model) { |
|
64 | - // Get the IDs of related entities for the datetime ID. |
|
65 | - // SELECT Ticket.TKT_ID FROM wp_esp_ticket AS Ticket |
|
66 | - // LEFT JOIN wp_esp_datetime_ticket AS Datetime_Ticket ON Datetime_Ticket.TKT_ID=Ticket.TKT_ID |
|
67 | - // LEFT JOIN wp_esp_datetime AS Datetime ON Datetime.DTT_ID=Datetime_Ticket.DTT_ID |
|
68 | - // WHERE Datetime.DTT_ID = ## |
|
69 | - $Ids = $model->get_col([ |
|
70 | - [ 'Datetime.DTT_ID' => $datetimeId ], |
|
71 | - 'default_where_conditions' => 'minimum', |
|
72 | - ]); |
|
73 | - $this->data['datetimes'][ $GID ][ $key ] = ! empty($Ids) |
|
74 | - ? $this->utilities->convertToGlobalId($model->item_name(), $Ids) |
|
75 | - : []; |
|
76 | - } |
|
77 | - } |
|
78 | - return is_array($datetimeIds) ? $datetimeIds : []; |
|
79 | - } |
|
44 | + /** |
|
45 | + * @param int $eventId |
|
46 | + * @return array |
|
47 | + * @throws EE_Error |
|
48 | + * @since 5.0.0.p |
|
49 | + */ |
|
50 | + private function processDatetimes(int $eventId): array |
|
51 | + { |
|
52 | + $related_models = [ |
|
53 | + 'tickets' => $this->ticket_model, |
|
54 | + ]; |
|
55 | + // Get the IDs of event datetimes. |
|
56 | + // SELECT Datetime.DTT_ID FROM wp_esp_datetime AS Datetime WHERE Datetime.EVT_ID = ## |
|
57 | + $datetimeIds = $this->datetime_model->get_col([ |
|
58 | + [ 'EVT_ID' => $eventId ], |
|
59 | + 'default_where_conditions' => 'minimum', |
|
60 | + ]); |
|
61 | + foreach ($datetimeIds as $datetimeId) { |
|
62 | + $GID = $this->utilities->convertToGlobalId($this->datetime_model->item_name(), $datetimeId); |
|
63 | + foreach ($related_models as $key => $model) { |
|
64 | + // Get the IDs of related entities for the datetime ID. |
|
65 | + // SELECT Ticket.TKT_ID FROM wp_esp_ticket AS Ticket |
|
66 | + // LEFT JOIN wp_esp_datetime_ticket AS Datetime_Ticket ON Datetime_Ticket.TKT_ID=Ticket.TKT_ID |
|
67 | + // LEFT JOIN wp_esp_datetime AS Datetime ON Datetime.DTT_ID=Datetime_Ticket.DTT_ID |
|
68 | + // WHERE Datetime.DTT_ID = ## |
|
69 | + $Ids = $model->get_col([ |
|
70 | + [ 'Datetime.DTT_ID' => $datetimeId ], |
|
71 | + 'default_where_conditions' => 'minimum', |
|
72 | + ]); |
|
73 | + $this->data['datetimes'][ $GID ][ $key ] = ! empty($Ids) |
|
74 | + ? $this->utilities->convertToGlobalId($model->item_name(), $Ids) |
|
75 | + : []; |
|
76 | + } |
|
77 | + } |
|
78 | + return is_array($datetimeIds) ? $datetimeIds : []; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * @param array $datetimeIds |
|
84 | - * @return array |
|
85 | - * @throws EE_Error |
|
86 | - * @since 5.0.0.p |
|
87 | - */ |
|
88 | - private function processTickets(array $datetimeIds): array |
|
89 | - { |
|
90 | - $related_models = [ |
|
91 | - 'datetimes' => $this->datetime_model, |
|
92 | - 'prices' => $this->price_model, |
|
93 | - ]; |
|
94 | - // Get the IDs of all datetime tickets. |
|
95 | - $ticketIds = $this->ticket_model->get_col([ |
|
96 | - [ |
|
97 | - 'OR' => [ |
|
98 | - 'Datetime.DTT_ID' => ['IN', $datetimeIds], |
|
99 | - 'TKT_is_default' => 1, |
|
100 | - ] |
|
101 | - ], |
|
102 | - 'default_where_conditions' => 'minimum', |
|
103 | - ]); |
|
104 | - foreach ($ticketIds as $ticketId) { |
|
105 | - $GID = $this->utilities->convertToGlobalId($this->ticket_model->item_name(), $ticketId); |
|
82 | + /** |
|
83 | + * @param array $datetimeIds |
|
84 | + * @return array |
|
85 | + * @throws EE_Error |
|
86 | + * @since 5.0.0.p |
|
87 | + */ |
|
88 | + private function processTickets(array $datetimeIds): array |
|
89 | + { |
|
90 | + $related_models = [ |
|
91 | + 'datetimes' => $this->datetime_model, |
|
92 | + 'prices' => $this->price_model, |
|
93 | + ]; |
|
94 | + // Get the IDs of all datetime tickets. |
|
95 | + $ticketIds = $this->ticket_model->get_col([ |
|
96 | + [ |
|
97 | + 'OR' => [ |
|
98 | + 'Datetime.DTT_ID' => ['IN', $datetimeIds], |
|
99 | + 'TKT_is_default' => 1, |
|
100 | + ] |
|
101 | + ], |
|
102 | + 'default_where_conditions' => 'minimum', |
|
103 | + ]); |
|
104 | + foreach ($ticketIds as $ticketId) { |
|
105 | + $GID = $this->utilities->convertToGlobalId($this->ticket_model->item_name(), $ticketId); |
|
106 | 106 | |
107 | - foreach ($related_models as $key => $model) { |
|
108 | - // Get the IDs of related entities for the ticket ID. |
|
109 | - $Ids = $model->get_col([ |
|
110 | - [ 'Ticket.TKT_ID' => $ticketId ], |
|
111 | - 'default_where_conditions' => 'minimum', |
|
112 | - ]); |
|
113 | - $this->data['tickets'][ $GID ][ $key ] = ! empty($Ids) |
|
114 | - ? $this->utilities->convertToGlobalId($model->item_name(), $Ids) |
|
115 | - : []; |
|
116 | - } |
|
117 | - } |
|
118 | - return is_array($ticketIds) ? $ticketIds : []; |
|
119 | - } |
|
107 | + foreach ($related_models as $key => $model) { |
|
108 | + // Get the IDs of related entities for the ticket ID. |
|
109 | + $Ids = $model->get_col([ |
|
110 | + [ 'Ticket.TKT_ID' => $ticketId ], |
|
111 | + 'default_where_conditions' => 'minimum', |
|
112 | + ]); |
|
113 | + $this->data['tickets'][ $GID ][ $key ] = ! empty($Ids) |
|
114 | + ? $this->utilities->convertToGlobalId($model->item_name(), $Ids) |
|
115 | + : []; |
|
116 | + } |
|
117 | + } |
|
118 | + return is_array($ticketIds) ? $ticketIds : []; |
|
119 | + } |
|
120 | 120 | |
121 | 121 | |
122 | - /** |
|
123 | - * @param array $ticketIds |
|
124 | - * @throws EE_Error |
|
125 | - * @since 5.0.0.p |
|
126 | - */ |
|
127 | - private function processPrices(array $ticketIds) |
|
128 | - { |
|
129 | - $related_models = [ |
|
130 | - 'tickets' => $this->ticket_model, |
|
131 | - 'priceTypes' => $this->price_type_model, |
|
132 | - ]; |
|
133 | - // Get the IDs of all ticket prices and default prices |
|
134 | - $priceIds = $this->price_model->get_col([ |
|
135 | - [ |
|
136 | - 'OR' => [ |
|
137 | - // either the price is related to any of these tickets |
|
138 | - 'Ticket.TKT_ID' => ['IN', $ticketIds], |
|
139 | - // or it's a default price and not trashed |
|
140 | - 'AND' => [ |
|
141 | - 'PRC_deleted' => 0, |
|
142 | - 'PRC_is_default' => 1, |
|
143 | - ], |
|
144 | - ], |
|
145 | - ], |
|
146 | - 'group_by' => 'PRC_ID', |
|
147 | - 'default_where_conditions' => 'minimum', |
|
148 | - ]); |
|
149 | - foreach ($priceIds as $priceId) { |
|
150 | - $GID = $this->utilities->convertToGlobalId($this->price_model->item_name(), $priceId); |
|
122 | + /** |
|
123 | + * @param array $ticketIds |
|
124 | + * @throws EE_Error |
|
125 | + * @since 5.0.0.p |
|
126 | + */ |
|
127 | + private function processPrices(array $ticketIds) |
|
128 | + { |
|
129 | + $related_models = [ |
|
130 | + 'tickets' => $this->ticket_model, |
|
131 | + 'priceTypes' => $this->price_type_model, |
|
132 | + ]; |
|
133 | + // Get the IDs of all ticket prices and default prices |
|
134 | + $priceIds = $this->price_model->get_col([ |
|
135 | + [ |
|
136 | + 'OR' => [ |
|
137 | + // either the price is related to any of these tickets |
|
138 | + 'Ticket.TKT_ID' => ['IN', $ticketIds], |
|
139 | + // or it's a default price and not trashed |
|
140 | + 'AND' => [ |
|
141 | + 'PRC_deleted' => 0, |
|
142 | + 'PRC_is_default' => 1, |
|
143 | + ], |
|
144 | + ], |
|
145 | + ], |
|
146 | + 'group_by' => 'PRC_ID', |
|
147 | + 'default_where_conditions' => 'minimum', |
|
148 | + ]); |
|
149 | + foreach ($priceIds as $priceId) { |
|
150 | + $GID = $this->utilities->convertToGlobalId($this->price_model->item_name(), $priceId); |
|
151 | 151 | |
152 | - foreach ($related_models as $key => $model) { |
|
153 | - // Get the IDs of related entities for the price ID. |
|
154 | - $Ids = $model->get_col([ |
|
155 | - [ 'Price.PRC_ID' => $priceId ], |
|
156 | - 'default_where_conditions' => 'minimum', |
|
157 | - ]); |
|
158 | - $this->data['prices'][ $GID ][ $key ] = ! empty($Ids) |
|
159 | - ? $this->utilities->convertToGlobalId($model->item_name(), $Ids) |
|
160 | - : []; |
|
161 | - } |
|
162 | - } |
|
163 | - } |
|
152 | + foreach ($related_models as $key => $model) { |
|
153 | + // Get the IDs of related entities for the price ID. |
|
154 | + $Ids = $model->get_col([ |
|
155 | + [ 'Price.PRC_ID' => $priceId ], |
|
156 | + 'default_where_conditions' => 'minimum', |
|
157 | + ]); |
|
158 | + $this->data['prices'][ $GID ][ $key ] = ! empty($Ids) |
|
159 | + ? $this->utilities->convertToGlobalId($model->item_name(), $Ids) |
|
160 | + : []; |
|
161 | + } |
|
162 | + } |
|
163 | + } |
|
164 | 164 | } |
@@ -21,150 +21,150 @@ |
||
21 | 21 | */ |
22 | 22 | class EventEditorGraphQLData |
23 | 23 | { |
24 | - /** |
|
25 | - * @var Event |
|
26 | - */ |
|
27 | - protected $event; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var Datetimes |
|
31 | - */ |
|
32 | - protected $datetimes; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var Prices |
|
36 | - */ |
|
37 | - protected $prices; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var PriceTypes |
|
41 | - */ |
|
42 | - protected $price_types; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var Tickets |
|
46 | - */ |
|
47 | - protected $tickets; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var EventEntityRelations |
|
51 | - */ |
|
52 | - protected $relations; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var EventManagerData |
|
56 | - */ |
|
57 | - protected $managers; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var NewEventDefaultEntities |
|
61 | - */ |
|
62 | - protected $default_entities; |
|
63 | - |
|
64 | - /** |
|
65 | - * @var TicketMeta |
|
66 | - */ |
|
67 | - protected $ticket_meta; |
|
68 | - |
|
69 | - /** |
|
70 | - * @var FormBuilder |
|
71 | - */ |
|
72 | - protected $form_builder; |
|
73 | - |
|
74 | - /** |
|
75 | - * @var Venues |
|
76 | - */ |
|
77 | - protected $venues; |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * EventEditorGraphQLData constructor. |
|
82 | - * |
|
83 | - * @param Datetimes $datetimes |
|
84 | - * @param Event $event |
|
85 | - * @param Prices $prices |
|
86 | - * @param PriceTypes $price_types |
|
87 | - * @param Tickets $tickets |
|
88 | - * @param EventEntityRelations $relations |
|
89 | - * @param EventManagerData $managers |
|
90 | - * @param NewEventDefaultEntities $default_entities |
|
91 | - * @param TicketMeta $ticket_meta |
|
92 | - * @param FormBuilder $form_builder |
|
93 | - * @param Venues $venues |
|
94 | - */ |
|
95 | - public function __construct( |
|
96 | - Datetimes $datetimes, |
|
97 | - Event $event, |
|
98 | - Prices $prices, |
|
99 | - PriceTypes $price_types, |
|
100 | - Tickets $tickets, |
|
101 | - EventEntityRelations $relations, |
|
102 | - EventManagerData $managers, |
|
103 | - NewEventDefaultEntities $default_entities, |
|
104 | - TicketMeta $ticket_meta, |
|
105 | - FormBuilder $form_builder, |
|
106 | - Venues $venues |
|
107 | - ) { |
|
108 | - $this->datetimes = $datetimes; |
|
109 | - $this->event = $event; |
|
110 | - $this->default_entities = $default_entities; |
|
111 | - $this->prices = $prices; |
|
112 | - $this->price_types = $price_types; |
|
113 | - $this->managers = $managers; |
|
114 | - $this->relations = $relations; |
|
115 | - $this->tickets = $tickets; |
|
116 | - $this->ticket_meta = $ticket_meta; |
|
117 | - $this->form_builder = $form_builder; |
|
118 | - $this->venues = $venues; |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param int $eventId |
|
124 | - * @return array |
|
125 | - * @throws EE_Error |
|
126 | - * @throws ReflectionException |
|
127 | - * @since 5.0.0.p |
|
128 | - */ |
|
129 | - public function getData(int $eventId) |
|
130 | - { |
|
131 | - $this->default_entities->getData($eventId); |
|
132 | - $event = $this->event->getData(['id' => $eventId]); |
|
133 | - $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
134 | - $eventManagers = $this->managers ->getData($eventId); |
|
135 | - |
|
136 | - $tickets = $this->tickets->getData([ |
|
137 | - 'eventId' => $eventId, |
|
138 | - 'includeDefaultTickets' => true, |
|
139 | - ]); |
|
140 | - |
|
141 | - $prices = $this->prices->getData([ |
|
142 | - 'eventId' => $eventId, |
|
143 | - 'includeDefaultTicketsPrices' => true, |
|
144 | - 'includeDefaultPrices' => true, |
|
145 | - ]); |
|
146 | - |
|
147 | - $priceTypes = $this->price_types->getData(); |
|
148 | - |
|
149 | - $relations = $this->relations->getData($eventId); |
|
150 | - |
|
151 | - $ticketMeta = $this->ticket_meta->getData($eventId); |
|
152 | - |
|
153 | - $formBuilder = $this->form_builder->getData($eventId); |
|
154 | - |
|
155 | - $venues = $this->venues->getData(); |
|
156 | - |
|
157 | - return compact( |
|
158 | - 'datetimes', |
|
159 | - 'event', |
|
160 | - 'eventManagers', |
|
161 | - 'formBuilder', |
|
162 | - 'prices', |
|
163 | - 'priceTypes', |
|
164 | - 'relations', |
|
165 | - 'tickets', |
|
166 | - 'ticketMeta', |
|
167 | - 'venues' |
|
168 | - ); |
|
169 | - } |
|
24 | + /** |
|
25 | + * @var Event |
|
26 | + */ |
|
27 | + protected $event; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var Datetimes |
|
31 | + */ |
|
32 | + protected $datetimes; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var Prices |
|
36 | + */ |
|
37 | + protected $prices; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var PriceTypes |
|
41 | + */ |
|
42 | + protected $price_types; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var Tickets |
|
46 | + */ |
|
47 | + protected $tickets; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var EventEntityRelations |
|
51 | + */ |
|
52 | + protected $relations; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var EventManagerData |
|
56 | + */ |
|
57 | + protected $managers; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var NewEventDefaultEntities |
|
61 | + */ |
|
62 | + protected $default_entities; |
|
63 | + |
|
64 | + /** |
|
65 | + * @var TicketMeta |
|
66 | + */ |
|
67 | + protected $ticket_meta; |
|
68 | + |
|
69 | + /** |
|
70 | + * @var FormBuilder |
|
71 | + */ |
|
72 | + protected $form_builder; |
|
73 | + |
|
74 | + /** |
|
75 | + * @var Venues |
|
76 | + */ |
|
77 | + protected $venues; |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * EventEditorGraphQLData constructor. |
|
82 | + * |
|
83 | + * @param Datetimes $datetimes |
|
84 | + * @param Event $event |
|
85 | + * @param Prices $prices |
|
86 | + * @param PriceTypes $price_types |
|
87 | + * @param Tickets $tickets |
|
88 | + * @param EventEntityRelations $relations |
|
89 | + * @param EventManagerData $managers |
|
90 | + * @param NewEventDefaultEntities $default_entities |
|
91 | + * @param TicketMeta $ticket_meta |
|
92 | + * @param FormBuilder $form_builder |
|
93 | + * @param Venues $venues |
|
94 | + */ |
|
95 | + public function __construct( |
|
96 | + Datetimes $datetimes, |
|
97 | + Event $event, |
|
98 | + Prices $prices, |
|
99 | + PriceTypes $price_types, |
|
100 | + Tickets $tickets, |
|
101 | + EventEntityRelations $relations, |
|
102 | + EventManagerData $managers, |
|
103 | + NewEventDefaultEntities $default_entities, |
|
104 | + TicketMeta $ticket_meta, |
|
105 | + FormBuilder $form_builder, |
|
106 | + Venues $venues |
|
107 | + ) { |
|
108 | + $this->datetimes = $datetimes; |
|
109 | + $this->event = $event; |
|
110 | + $this->default_entities = $default_entities; |
|
111 | + $this->prices = $prices; |
|
112 | + $this->price_types = $price_types; |
|
113 | + $this->managers = $managers; |
|
114 | + $this->relations = $relations; |
|
115 | + $this->tickets = $tickets; |
|
116 | + $this->ticket_meta = $ticket_meta; |
|
117 | + $this->form_builder = $form_builder; |
|
118 | + $this->venues = $venues; |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param int $eventId |
|
124 | + * @return array |
|
125 | + * @throws EE_Error |
|
126 | + * @throws ReflectionException |
|
127 | + * @since 5.0.0.p |
|
128 | + */ |
|
129 | + public function getData(int $eventId) |
|
130 | + { |
|
131 | + $this->default_entities->getData($eventId); |
|
132 | + $event = $this->event->getData(['id' => $eventId]); |
|
133 | + $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
134 | + $eventManagers = $this->managers ->getData($eventId); |
|
135 | + |
|
136 | + $tickets = $this->tickets->getData([ |
|
137 | + 'eventId' => $eventId, |
|
138 | + 'includeDefaultTickets' => true, |
|
139 | + ]); |
|
140 | + |
|
141 | + $prices = $this->prices->getData([ |
|
142 | + 'eventId' => $eventId, |
|
143 | + 'includeDefaultTicketsPrices' => true, |
|
144 | + 'includeDefaultPrices' => true, |
|
145 | + ]); |
|
146 | + |
|
147 | + $priceTypes = $this->price_types->getData(); |
|
148 | + |
|
149 | + $relations = $this->relations->getData($eventId); |
|
150 | + |
|
151 | + $ticketMeta = $this->ticket_meta->getData($eventId); |
|
152 | + |
|
153 | + $formBuilder = $this->form_builder->getData($eventId); |
|
154 | + |
|
155 | + $venues = $this->venues->getData(); |
|
156 | + |
|
157 | + return compact( |
|
158 | + 'datetimes', |
|
159 | + 'event', |
|
160 | + 'eventManagers', |
|
161 | + 'formBuilder', |
|
162 | + 'prices', |
|
163 | + 'priceTypes', |
|
164 | + 'relations', |
|
165 | + 'tickets', |
|
166 | + 'ticketMeta', |
|
167 | + 'venues' |
|
168 | + ); |
|
169 | + } |
|
170 | 170 | } |
@@ -37,86 +37,86 @@ |
||
37 | 37 | */ |
38 | 38 | class AdvancedEditorAdminFormSection |
39 | 39 | { |
40 | - /** |
|
41 | - * @var EE_Admin_Config |
|
42 | - */ |
|
43 | - protected $admin_config; |
|
40 | + /** |
|
41 | + * @var EE_Admin_Config |
|
42 | + */ |
|
43 | + protected $admin_config; |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * AdvancedEditorAdminForm constructor. |
|
48 | - * |
|
49 | - * @param EE_Admin_Config $admin_config |
|
50 | - */ |
|
51 | - public function __construct(EE_Admin_Config $admin_config) |
|
52 | - { |
|
53 | - $this->admin_config = $admin_config; |
|
54 | - add_filter( |
|
55 | - 'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections', |
|
56 | - [$this, 'mergeFormSubsections'] |
|
57 | - ); |
|
58 | - add_action( |
|
59 | - 'AHEE__Events_Admin_Page___update_default_event_settings', |
|
60 | - [$this, 'updateAdminFormSettings'], |
|
61 | - 10, |
|
62 | - 2 |
|
63 | - ); |
|
64 | - } |
|
46 | + /** |
|
47 | + * AdvancedEditorAdminForm constructor. |
|
48 | + * |
|
49 | + * @param EE_Admin_Config $admin_config |
|
50 | + */ |
|
51 | + public function __construct(EE_Admin_Config $admin_config) |
|
52 | + { |
|
53 | + $this->admin_config = $admin_config; |
|
54 | + add_filter( |
|
55 | + 'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections', |
|
56 | + [$this, 'mergeFormSubsections'] |
|
57 | + ); |
|
58 | + add_action( |
|
59 | + 'AHEE__Events_Admin_Page___update_default_event_settings', |
|
60 | + [$this, 'updateAdminFormSettings'], |
|
61 | + 10, |
|
62 | + 2 |
|
63 | + ); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * @param array $default_event_settings_form_subsections |
|
69 | - * @return array |
|
70 | - * @since 5.0.0.p |
|
71 | - */ |
|
72 | - public function mergeFormSubsections(array $default_event_settings_form_subsections) |
|
73 | - { |
|
74 | - return [ |
|
75 | - 'new_features_section_header' => new EE_Form_Section_HTML( |
|
76 | - EEH_HTML::h2( |
|
77 | - esc_html__('New Feature', 'event_espresso'), |
|
78 | - '', |
|
79 | - 'ee-admin-settings-hdr ee-admin-settings-hdr--new-feature' |
|
80 | - ) |
|
81 | - ), |
|
82 | - 'use_advanced_editor' => new EE_Select_Input( |
|
83 | - apply_filters( |
|
84 | - 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_answer_options', |
|
85 | - [ |
|
86 | - esc_html__('Legacy Editor', 'event_espresso'), |
|
87 | - esc_html__('Advanced Editor', 'event_espresso'), |
|
88 | - ] |
|
89 | - ), |
|
90 | - apply_filters( |
|
91 | - 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_settings', |
|
92 | - [ |
|
93 | - 'default' => $this->admin_config->useAdvancedEditor(), |
|
94 | - 'html_label_text' => esc_html__('Activate Advanced Editor?', 'event_espresso'), |
|
95 | - 'html_help_text' => sprintf( |
|
96 | - esc_html__( |
|
97 | - '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.', |
|
98 | - 'event_espresso' |
|
99 | - ), |
|
100 | - '<br />' |
|
101 | - ), |
|
102 | - ] |
|
103 | - ) |
|
104 | - ), |
|
105 | - ] + $default_event_settings_form_subsections; |
|
106 | - } |
|
67 | + /** |
|
68 | + * @param array $default_event_settings_form_subsections |
|
69 | + * @return array |
|
70 | + * @since 5.0.0.p |
|
71 | + */ |
|
72 | + public function mergeFormSubsections(array $default_event_settings_form_subsections) |
|
73 | + { |
|
74 | + return [ |
|
75 | + 'new_features_section_header' => new EE_Form_Section_HTML( |
|
76 | + EEH_HTML::h2( |
|
77 | + esc_html__('New Feature', 'event_espresso'), |
|
78 | + '', |
|
79 | + 'ee-admin-settings-hdr ee-admin-settings-hdr--new-feature' |
|
80 | + ) |
|
81 | + ), |
|
82 | + 'use_advanced_editor' => new EE_Select_Input( |
|
83 | + apply_filters( |
|
84 | + 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_answer_options', |
|
85 | + [ |
|
86 | + esc_html__('Legacy Editor', 'event_espresso'), |
|
87 | + esc_html__('Advanced Editor', 'event_espresso'), |
|
88 | + ] |
|
89 | + ), |
|
90 | + apply_filters( |
|
91 | + 'FHEE__Events_Admin_Page___default_event_settings_form__advanced_editor_input_settings', |
|
92 | + [ |
|
93 | + 'default' => $this->admin_config->useAdvancedEditor(), |
|
94 | + 'html_label_text' => esc_html__('Activate Advanced Editor?', 'event_espresso'), |
|
95 | + 'html_help_text' => sprintf( |
|
96 | + esc_html__( |
|
97 | + '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.', |
|
98 | + 'event_espresso' |
|
99 | + ), |
|
100 | + '<br />' |
|
101 | + ), |
|
102 | + ] |
|
103 | + ) |
|
104 | + ), |
|
105 | + ] + $default_event_settings_form_subsections; |
|
106 | + } |
|
107 | 107 | |
108 | 108 | |
109 | - /** |
|
110 | - * @param array $valid_data |
|
111 | - * @param EE_Config $config |
|
112 | - * @since 5.0.0.p |
|
113 | - */ |
|
114 | - public function updateAdminFormSettings(array $valid_data, EE_Config $config) |
|
115 | - { |
|
116 | - $config->admin->setUseAdvancedEditor( |
|
117 | - isset($valid_data['use_advanced_editor']) |
|
118 | - ? $valid_data['use_advanced_editor'] |
|
119 | - : false |
|
120 | - ); |
|
121 | - } |
|
109 | + /** |
|
110 | + * @param array $valid_data |
|
111 | + * @param EE_Config $config |
|
112 | + * @since 5.0.0.p |
|
113 | + */ |
|
114 | + public function updateAdminFormSettings(array $valid_data, EE_Config $config) |
|
115 | + { |
|
116 | + $config->admin->setUseAdvancedEditor( |
|
117 | + isset($valid_data['use_advanced_editor']) |
|
118 | + ? $valid_data['use_advanced_editor'] |
|
119 | + : false |
|
120 | + ); |
|
121 | + } |
|
122 | 122 | } |