@@ -81,7 +81,7 @@ |
||
81 | 81 | */ |
82 | 82 | public function namespacedBlockType() |
83 | 83 | { |
84 | - return self::NAME_SPACE . '/' . $this->block_type; |
|
84 | + return self::NAME_SPACE.'/'.$this->block_type; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 |
@@ -21,211 +21,211 @@ |
||
21 | 21 | abstract class Block implements BlockInterface |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * BlockAssetManager that this editor block uses for asset registration |
|
26 | - * |
|
27 | - * @var BlockAssetManagerInterface $block_asset_manager |
|
28 | - */ |
|
29 | - protected $block_asset_manager; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var RequestInterface $request |
|
33 | - */ |
|
34 | - protected $request; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var array $attributes |
|
38 | - */ |
|
39 | - private $attributes; |
|
40 | - |
|
41 | - /** |
|
42 | - * If set to true, then the block will render its content client side |
|
43 | - * If false, then the block will render its content server side using the renderBlock() method |
|
44 | - * |
|
45 | - * @var bool $dynamic |
|
46 | - */ |
|
47 | - private $dynamic = false; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string $block_type |
|
51 | - */ |
|
52 | - private $block_type; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var array $supported_routes |
|
56 | - */ |
|
57 | - private $supported_routes; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var WP_Block_Type $wp_block_type |
|
61 | - */ |
|
62 | - private $wp_block_type; |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * BlockLoader constructor. |
|
67 | - * |
|
68 | - * @param BlockAssetManagerInterface $block_asset_manager |
|
69 | - * @param RequestInterface $request |
|
70 | - */ |
|
71 | - public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request) |
|
72 | - { |
|
73 | - $this->block_asset_manager = $block_asset_manager; |
|
74 | - $this->request = $request; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @return string |
|
80 | - */ |
|
81 | - public function blockType() |
|
82 | - { |
|
83 | - return $this->block_type; |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function namespacedBlockType() |
|
91 | - { |
|
92 | - return self::NAME_SPACE . '/' . $this->block_type; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * @param string $block_type |
|
98 | - */ |
|
99 | - protected function setBlockType($block_type) |
|
100 | - { |
|
101 | - $this->block_type = $block_type; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * BlockAssetManager that this editor block uses for asset registration |
|
107 | - * |
|
108 | - * @return BlockAssetManagerInterface |
|
109 | - */ |
|
110 | - public function assetManager() |
|
111 | - { |
|
112 | - return $this->block_asset_manager; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @param WP_Block_Type $wp_block_type |
|
118 | - */ |
|
119 | - protected function setWpBlockType($wp_block_type) |
|
120 | - { |
|
121 | - $this->wp_block_type = $wp_block_type; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * returns an array of fully qualified class names |
|
126 | - * for RouteMatchSpecificationInterface objects |
|
127 | - * that specify routes that the block should be loaded for. |
|
128 | - * |
|
129 | - * @return array |
|
130 | - */ |
|
131 | - public function supportedRoutes() |
|
132 | - { |
|
133 | - return $this->supported_routes; |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * @param array $supported_routes |
|
139 | - */ |
|
140 | - protected function setSupportedRoutes(array $supported_routes) |
|
141 | - { |
|
142 | - $this->supported_routes = $supported_routes; |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - /** |
|
147 | - * @return array |
|
148 | - */ |
|
149 | - public function attributes() |
|
150 | - { |
|
151 | - return $this->attributes; |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * @param array $attributes |
|
157 | - */ |
|
158 | - public function setAttributes(array $attributes) |
|
159 | - { |
|
160 | - $this->attributes = $attributes; |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * @return bool |
|
166 | - */ |
|
167 | - public function isDynamic() |
|
168 | - { |
|
169 | - return $this->dynamic; |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * @param bool $dynamic |
|
175 | - */ |
|
176 | - public function setDynamic($dynamic = true) |
|
177 | - { |
|
178 | - $this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * Registers the Editor Block with WP core; |
|
184 | - * Returns the registered block type on success, or false on failure. |
|
185 | - * |
|
186 | - * @return WP_Block_Type|false |
|
187 | - */ |
|
188 | - public function registerBlock() |
|
189 | - { |
|
190 | - $args = array( |
|
191 | - 'attributes' => $this->attributes(), |
|
192 | - 'editor_script' => $this->block_asset_manager->getEditorScriptHandle(), |
|
193 | - 'editor_style' => $this->block_asset_manager->getEditorStyleHandle(), |
|
194 | - 'script' => $this->block_asset_manager->getScriptHandle(), |
|
195 | - 'style' => $this->block_asset_manager->getStyleHandle(), |
|
196 | - ); |
|
197 | - if ($this->isDynamic()) { |
|
198 | - $args['render_callback'] = array($this, 'renderBlock'); |
|
199 | - } |
|
200 | - $wp_block_type = register_block_type( |
|
201 | - new WP_Block_Type( |
|
202 | - $this->namespacedBlockType(), |
|
203 | - $args |
|
204 | - ) |
|
205 | - ); |
|
206 | - $this->setWpBlockType($wp_block_type); |
|
207 | - return $wp_block_type; |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - /** |
|
212 | - * @return WP_Block_Type|false The registered block type on success, or false on failure. |
|
213 | - */ |
|
214 | - public function unRegisterBlock() |
|
215 | - { |
|
216 | - return unregister_block_type($this->namespacedBlockType()); |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - |
|
221 | - /** |
|
222 | - * @return array |
|
223 | - */ |
|
224 | - public function getEditorContainer() |
|
225 | - { |
|
226 | - return array( |
|
227 | - $this->namespacedBlockType(), |
|
228 | - array(), |
|
229 | - ); |
|
230 | - } |
|
24 | + /** |
|
25 | + * BlockAssetManager that this editor block uses for asset registration |
|
26 | + * |
|
27 | + * @var BlockAssetManagerInterface $block_asset_manager |
|
28 | + */ |
|
29 | + protected $block_asset_manager; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var RequestInterface $request |
|
33 | + */ |
|
34 | + protected $request; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var array $attributes |
|
38 | + */ |
|
39 | + private $attributes; |
|
40 | + |
|
41 | + /** |
|
42 | + * If set to true, then the block will render its content client side |
|
43 | + * If false, then the block will render its content server side using the renderBlock() method |
|
44 | + * |
|
45 | + * @var bool $dynamic |
|
46 | + */ |
|
47 | + private $dynamic = false; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string $block_type |
|
51 | + */ |
|
52 | + private $block_type; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var array $supported_routes |
|
56 | + */ |
|
57 | + private $supported_routes; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var WP_Block_Type $wp_block_type |
|
61 | + */ |
|
62 | + private $wp_block_type; |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * BlockLoader constructor. |
|
67 | + * |
|
68 | + * @param BlockAssetManagerInterface $block_asset_manager |
|
69 | + * @param RequestInterface $request |
|
70 | + */ |
|
71 | + public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request) |
|
72 | + { |
|
73 | + $this->block_asset_manager = $block_asset_manager; |
|
74 | + $this->request = $request; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @return string |
|
80 | + */ |
|
81 | + public function blockType() |
|
82 | + { |
|
83 | + return $this->block_type; |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function namespacedBlockType() |
|
91 | + { |
|
92 | + return self::NAME_SPACE . '/' . $this->block_type; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * @param string $block_type |
|
98 | + */ |
|
99 | + protected function setBlockType($block_type) |
|
100 | + { |
|
101 | + $this->block_type = $block_type; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * BlockAssetManager that this editor block uses for asset registration |
|
107 | + * |
|
108 | + * @return BlockAssetManagerInterface |
|
109 | + */ |
|
110 | + public function assetManager() |
|
111 | + { |
|
112 | + return $this->block_asset_manager; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @param WP_Block_Type $wp_block_type |
|
118 | + */ |
|
119 | + protected function setWpBlockType($wp_block_type) |
|
120 | + { |
|
121 | + $this->wp_block_type = $wp_block_type; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * returns an array of fully qualified class names |
|
126 | + * for RouteMatchSpecificationInterface objects |
|
127 | + * that specify routes that the block should be loaded for. |
|
128 | + * |
|
129 | + * @return array |
|
130 | + */ |
|
131 | + public function supportedRoutes() |
|
132 | + { |
|
133 | + return $this->supported_routes; |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * @param array $supported_routes |
|
139 | + */ |
|
140 | + protected function setSupportedRoutes(array $supported_routes) |
|
141 | + { |
|
142 | + $this->supported_routes = $supported_routes; |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + /** |
|
147 | + * @return array |
|
148 | + */ |
|
149 | + public function attributes() |
|
150 | + { |
|
151 | + return $this->attributes; |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * @param array $attributes |
|
157 | + */ |
|
158 | + public function setAttributes(array $attributes) |
|
159 | + { |
|
160 | + $this->attributes = $attributes; |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * @return bool |
|
166 | + */ |
|
167 | + public function isDynamic() |
|
168 | + { |
|
169 | + return $this->dynamic; |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * @param bool $dynamic |
|
175 | + */ |
|
176 | + public function setDynamic($dynamic = true) |
|
177 | + { |
|
178 | + $this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * Registers the Editor Block with WP core; |
|
184 | + * Returns the registered block type on success, or false on failure. |
|
185 | + * |
|
186 | + * @return WP_Block_Type|false |
|
187 | + */ |
|
188 | + public function registerBlock() |
|
189 | + { |
|
190 | + $args = array( |
|
191 | + 'attributes' => $this->attributes(), |
|
192 | + 'editor_script' => $this->block_asset_manager->getEditorScriptHandle(), |
|
193 | + 'editor_style' => $this->block_asset_manager->getEditorStyleHandle(), |
|
194 | + 'script' => $this->block_asset_manager->getScriptHandle(), |
|
195 | + 'style' => $this->block_asset_manager->getStyleHandle(), |
|
196 | + ); |
|
197 | + if ($this->isDynamic()) { |
|
198 | + $args['render_callback'] = array($this, 'renderBlock'); |
|
199 | + } |
|
200 | + $wp_block_type = register_block_type( |
|
201 | + new WP_Block_Type( |
|
202 | + $this->namespacedBlockType(), |
|
203 | + $args |
|
204 | + ) |
|
205 | + ); |
|
206 | + $this->setWpBlockType($wp_block_type); |
|
207 | + return $wp_block_type; |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + /** |
|
212 | + * @return WP_Block_Type|false The registered block type on success, or false on failure. |
|
213 | + */ |
|
214 | + public function unRegisterBlock() |
|
215 | + { |
|
216 | + return unregister_block_type($this->namespacedBlockType()); |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + |
|
221 | + /** |
|
222 | + * @return array |
|
223 | + */ |
|
224 | + public function getEditorContainer() |
|
225 | + { |
|
226 | + return array( |
|
227 | + $this->namespacedBlockType(), |
|
228 | + array(), |
|
229 | + ); |
|
230 | + } |
|
231 | 231 | } |
@@ -28,112 +28,112 @@ |
||
28 | 28 | class PrivacySettingsFormHandler extends FormHandler |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @var EE_Config |
|
33 | - */ |
|
34 | - protected $config; |
|
31 | + /** |
|
32 | + * @var EE_Config |
|
33 | + */ |
|
34 | + protected $config; |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * PrivacySettingsFormHandler constructor. |
|
39 | - * |
|
40 | - * @param EE_Registry $registry |
|
41 | - * @param EE_Config $config |
|
42 | - */ |
|
43 | - public function __construct(EE_Registry $registry, EE_Config $config) |
|
44 | - { |
|
45 | - $this->config = $config; |
|
46 | - parent::__construct( |
|
47 | - esc_html__('Privacy Settings', 'event_espresso'), |
|
48 | - esc_html__('Privacy Settings', 'event_espresso'), |
|
49 | - 'privacy-settings', |
|
50 | - '', |
|
51 | - FormHandler::DO_NOT_SETUP_FORM, |
|
52 | - $registry |
|
53 | - ); |
|
54 | - } |
|
37 | + /** |
|
38 | + * PrivacySettingsFormHandler constructor. |
|
39 | + * |
|
40 | + * @param EE_Registry $registry |
|
41 | + * @param EE_Config $config |
|
42 | + */ |
|
43 | + public function __construct(EE_Registry $registry, EE_Config $config) |
|
44 | + { |
|
45 | + $this->config = $config; |
|
46 | + parent::__construct( |
|
47 | + esc_html__('Privacy Settings', 'event_espresso'), |
|
48 | + esc_html__('Privacy Settings', 'event_espresso'), |
|
49 | + 'privacy-settings', |
|
50 | + '', |
|
51 | + FormHandler::DO_NOT_SETUP_FORM, |
|
52 | + $registry |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * creates and returns the actual form |
|
59 | - * |
|
60 | - * @return EE_Form_Section_Proper |
|
61 | - */ |
|
62 | - public function generate() |
|
63 | - { |
|
64 | - // this form makes use of the session for passing around invalid form submission data, so make sure its enabled |
|
65 | - add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false'); |
|
66 | - /** |
|
67 | - * @var $reg_config EE_Registration_Config |
|
68 | - */ |
|
69 | - $reg_config = $this->config->registration; |
|
70 | - return new EE_Form_Section_Proper( |
|
71 | - array( |
|
72 | - 'name' => 'privacy_consent_settings', |
|
73 | - 'subsections' => array( |
|
74 | - 'privacy_consent_form_hdr' => new EE_Form_Section_HTML( |
|
75 | - EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso')) |
|
76 | - ), |
|
77 | - 'enable' => new EE_Select_Reveal_Input( |
|
78 | - array( |
|
79 | - 'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'), |
|
80 | - 'disable' => esc_html__('Disabled', 'event_espresso'), |
|
81 | - ), |
|
82 | - array( |
|
83 | - 'default' => $reg_config->isConsentCheckboxEnabled() |
|
84 | - ? 'enable-privacy-consent' |
|
85 | - : 'disable', |
|
86 | - 'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'), |
|
87 | - 'html_help_text' => esc_html__( |
|
88 | - 'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.', |
|
89 | - 'event_espresso' |
|
90 | - ), |
|
91 | - ) |
|
92 | - ), |
|
93 | - 'enable-privacy-consent' => new EE_Form_Section_Proper( |
|
94 | - array( |
|
95 | - 'subsections' => array( |
|
96 | - 'consent_assertion' => new EE_Text_Area_Input( |
|
97 | - array( |
|
98 | - 'default' => $reg_config->getConsentCheckboxLabelText(), |
|
99 | - 'html_label_text' => esc_html__('Consent Text', 'event_espresso'), |
|
100 | - 'html_help_text' => esc_html__( |
|
101 | - 'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.', |
|
102 | - 'event_espresso' |
|
103 | - ), |
|
104 | - 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
105 | - ) |
|
106 | - ), |
|
107 | - ), |
|
108 | - ) |
|
109 | - ), |
|
110 | - ), |
|
111 | - ) |
|
112 | - ); |
|
113 | - } |
|
57 | + /** |
|
58 | + * creates and returns the actual form |
|
59 | + * |
|
60 | + * @return EE_Form_Section_Proper |
|
61 | + */ |
|
62 | + public function generate() |
|
63 | + { |
|
64 | + // this form makes use of the session for passing around invalid form submission data, so make sure its enabled |
|
65 | + add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false'); |
|
66 | + /** |
|
67 | + * @var $reg_config EE_Registration_Config |
|
68 | + */ |
|
69 | + $reg_config = $this->config->registration; |
|
70 | + return new EE_Form_Section_Proper( |
|
71 | + array( |
|
72 | + 'name' => 'privacy_consent_settings', |
|
73 | + 'subsections' => array( |
|
74 | + 'privacy_consent_form_hdr' => new EE_Form_Section_HTML( |
|
75 | + EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso')) |
|
76 | + ), |
|
77 | + 'enable' => new EE_Select_Reveal_Input( |
|
78 | + array( |
|
79 | + 'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'), |
|
80 | + 'disable' => esc_html__('Disabled', 'event_espresso'), |
|
81 | + ), |
|
82 | + array( |
|
83 | + 'default' => $reg_config->isConsentCheckboxEnabled() |
|
84 | + ? 'enable-privacy-consent' |
|
85 | + : 'disable', |
|
86 | + 'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'), |
|
87 | + 'html_help_text' => esc_html__( |
|
88 | + 'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.', |
|
89 | + 'event_espresso' |
|
90 | + ), |
|
91 | + ) |
|
92 | + ), |
|
93 | + 'enable-privacy-consent' => new EE_Form_Section_Proper( |
|
94 | + array( |
|
95 | + 'subsections' => array( |
|
96 | + 'consent_assertion' => new EE_Text_Area_Input( |
|
97 | + array( |
|
98 | + 'default' => $reg_config->getConsentCheckboxLabelText(), |
|
99 | + 'html_label_text' => esc_html__('Consent Text', 'event_espresso'), |
|
100 | + 'html_help_text' => esc_html__( |
|
101 | + 'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.', |
|
102 | + 'event_espresso' |
|
103 | + ), |
|
104 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
105 | + ) |
|
106 | + ), |
|
107 | + ), |
|
108 | + ) |
|
109 | + ), |
|
110 | + ), |
|
111 | + ) |
|
112 | + ); |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * After validating the form data, update the registration config |
|
118 | - * |
|
119 | - * @param array $submitted_form_data |
|
120 | - * @return bool |
|
121 | - */ |
|
122 | - public function process($submitted_form_data = array()) |
|
123 | - { |
|
124 | - try { |
|
125 | - $valid_data = parent::process($submitted_form_data); |
|
126 | - $reg_config = $this->config->registration; |
|
127 | - $reg_config->setConsentCheckboxEnabled($valid_data['enable'] === 'enable-privacy-consent'); |
|
128 | - $reg_config->setConsentCheckboxLabelText( |
|
129 | - $valid_data['enable-privacy-consent']['consent_assertion'] |
|
130 | - ); |
|
131 | - return $this->config->update_espresso_config(false, false); |
|
132 | - } catch (InvalidFormSubmissionException $e) { |
|
133 | - // the form was invalid, it should be re-displayed with errors |
|
134 | - return false; |
|
135 | - } |
|
136 | - } |
|
116 | + /** |
|
117 | + * After validating the form data, update the registration config |
|
118 | + * |
|
119 | + * @param array $submitted_form_data |
|
120 | + * @return bool |
|
121 | + */ |
|
122 | + public function process($submitted_form_data = array()) |
|
123 | + { |
|
124 | + try { |
|
125 | + $valid_data = parent::process($submitted_form_data); |
|
126 | + $reg_config = $this->config->registration; |
|
127 | + $reg_config->setConsentCheckboxEnabled($valid_data['enable'] === 'enable-privacy-consent'); |
|
128 | + $reg_config->setConsentCheckboxLabelText( |
|
129 | + $valid_data['enable-privacy-consent']['consent_assertion'] |
|
130 | + ); |
|
131 | + return $this->config->update_espresso_config(false, false); |
|
132 | + } catch (InvalidFormSubmissionException $e) { |
|
133 | + // the form was invalid, it should be re-displayed with errors |
|
134 | + return false; |
|
135 | + } |
|
136 | + } |
|
137 | 137 | } |
138 | 138 | // End of file PrivacySettingsFormHandler.php |
139 | 139 | // Location: EventEspresso\core\domain\services\admin\privacy\forms/PrivacySettingsFormHandler.php |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | $this->organization_config->instagram = isset($form_data['organization_instagram']) |
448 | 448 | ? esc_url_raw($form_data['organization_instagram']) |
449 | 449 | : $this->organization_config->instagram; |
450 | - $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
451 | - ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
450 | + $this->core_config->ee_ueip_optin = isset($form_data[EE_Core_Config::OPTION_NAME_UXIP][0]) |
|
451 | + ? filter_var($form_data[EE_Core_Config::OPTION_NAME_UXIP][0], FILTER_VALIDATE_BOOLEAN) |
|
452 | 452 | : false; |
453 | 453 | $this->core_config->ee_ueip_has_notified = true; |
454 | 454 | |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | if (empty($this->network_core_config->site_license_key)) { |
480 | 480 | return false; |
481 | 481 | } |
482 | - $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
482 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
483 | 483 | $verify_fail = get_option($ver_option_key, false); |
484 | 484 | return $verify_fail === false |
485 | - || (! empty($this->network_core_config->site_license_key) |
|
485 | + || ( ! empty($this->network_core_config->site_license_key) |
|
486 | 486 | && $verify_fail === false |
487 | 487 | ); |
488 | 488 | } |
@@ -528,6 +528,6 @@ discard block |
||
528 | 528 | private function getValidationIndicator() |
529 | 529 | { |
530 | 530 | $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red'; |
531 | - return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>'; |
|
531 | + return '<span class="dashicons dashicons-admin-network '.$verified_class.' ee-icon-size-20"></span>'; |
|
532 | 532 | } |
533 | 533 | } |
@@ -44,531 +44,531 @@ |
||
44 | 44 | class OrganizationSettings extends FormHandler |
45 | 45 | { |
46 | 46 | |
47 | - /** |
|
48 | - * @var EE_Organization_Config |
|
49 | - */ |
|
50 | - protected $organization_config; |
|
47 | + /** |
|
48 | + * @var EE_Organization_Config |
|
49 | + */ |
|
50 | + protected $organization_config; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @var EE_Core_Config |
|
54 | - */ |
|
55 | - protected $core_config; |
|
52 | + /** |
|
53 | + * @var EE_Core_Config |
|
54 | + */ |
|
55 | + protected $core_config; |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * @var EE_Network_Core_Config |
|
60 | - */ |
|
61 | - protected $network_core_config; |
|
58 | + /** |
|
59 | + * @var EE_Network_Core_Config |
|
60 | + */ |
|
61 | + protected $network_core_config; |
|
62 | 62 | |
63 | - /** |
|
64 | - * @var CountrySubRegionDao $countrySubRegionDao |
|
65 | - */ |
|
66 | - protected $countrySubRegionDao; |
|
63 | + /** |
|
64 | + * @var CountrySubRegionDao $countrySubRegionDao |
|
65 | + */ |
|
66 | + protected $countrySubRegionDao; |
|
67 | 67 | |
68 | - /** |
|
69 | - * Form constructor. |
|
70 | - * |
|
71 | - * @param EE_Registry $registry |
|
72 | - * @param EE_Organization_Config $organization_config |
|
73 | - * @param EE_Core_Config $core_config |
|
74 | - * @param EE_Network_Core_Config $network_core_config |
|
75 | - * @param CountrySubRegionDao $countrySubRegionDao |
|
76 | - * @throws InvalidArgumentException |
|
77 | - * @throws InvalidDataTypeException |
|
78 | - * @throws DomainException |
|
79 | - */ |
|
80 | - public function __construct( |
|
81 | - EE_Registry $registry, |
|
82 | - EE_Organization_Config $organization_config, |
|
83 | - EE_Core_Config $core_config, |
|
84 | - EE_Network_Core_Config $network_core_config, |
|
85 | - CountrySubRegionDao $countrySubRegionDao |
|
86 | - ) { |
|
87 | - $this->organization_config = $organization_config; |
|
88 | - $this->core_config = $core_config; |
|
89 | - $this->network_core_config = $network_core_config; |
|
90 | - $this->countrySubRegionDao = $countrySubRegionDao; |
|
91 | - parent::__construct( |
|
92 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
93 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
94 | - 'organization_settings', |
|
95 | - '', |
|
96 | - FormHandler::DO_NOT_SETUP_FORM, |
|
97 | - $registry |
|
98 | - ); |
|
99 | - } |
|
68 | + /** |
|
69 | + * Form constructor. |
|
70 | + * |
|
71 | + * @param EE_Registry $registry |
|
72 | + * @param EE_Organization_Config $organization_config |
|
73 | + * @param EE_Core_Config $core_config |
|
74 | + * @param EE_Network_Core_Config $network_core_config |
|
75 | + * @param CountrySubRegionDao $countrySubRegionDao |
|
76 | + * @throws InvalidArgumentException |
|
77 | + * @throws InvalidDataTypeException |
|
78 | + * @throws DomainException |
|
79 | + */ |
|
80 | + public function __construct( |
|
81 | + EE_Registry $registry, |
|
82 | + EE_Organization_Config $organization_config, |
|
83 | + EE_Core_Config $core_config, |
|
84 | + EE_Network_Core_Config $network_core_config, |
|
85 | + CountrySubRegionDao $countrySubRegionDao |
|
86 | + ) { |
|
87 | + $this->organization_config = $organization_config; |
|
88 | + $this->core_config = $core_config; |
|
89 | + $this->network_core_config = $network_core_config; |
|
90 | + $this->countrySubRegionDao = $countrySubRegionDao; |
|
91 | + parent::__construct( |
|
92 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
93 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
94 | + 'organization_settings', |
|
95 | + '', |
|
96 | + FormHandler::DO_NOT_SETUP_FORM, |
|
97 | + $registry |
|
98 | + ); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | |
102 | - /** |
|
103 | - * creates and returns the actual form |
|
104 | - * |
|
105 | - * @return EE_Form_Section_Proper |
|
106 | - * @throws EE_Error |
|
107 | - * @throws InvalidArgumentException |
|
108 | - * @throws InvalidDataTypeException |
|
109 | - * @throws InvalidInterfaceException |
|
110 | - * @throws ReflectionException |
|
111 | - */ |
|
112 | - public function generate() |
|
113 | - { |
|
114 | - $has_sub_regions = EEM_State::instance()->count( |
|
115 | - array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO)) |
|
116 | - ); |
|
117 | - $form = new EE_Form_Section_Proper( |
|
118 | - array( |
|
119 | - 'name' => 'organization_settings', |
|
120 | - 'html_id' => 'organization_settings', |
|
121 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
122 | - 'subsections' => array( |
|
123 | - 'contact_information_hdr' => new EE_Form_Section_HTML( |
|
124 | - EEH_HTML::h2( |
|
125 | - esc_html__('Contact Information', 'event_espresso') |
|
126 | - . ' ' |
|
127 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
|
128 | - '', |
|
129 | - 'contact-information-hdr' |
|
130 | - ) |
|
131 | - ), |
|
132 | - 'organization_name' => new EE_Text_Input( |
|
133 | - array( |
|
134 | - 'html_name' => 'organization_name', |
|
135 | - 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
|
136 | - 'html_help_text' => esc_html__( |
|
137 | - 'Displayed on all emails and invoices.', |
|
138 | - 'event_espresso' |
|
139 | - ), |
|
140 | - 'default' => $this->organization_config->get_pretty('name'), |
|
141 | - 'required' => false, |
|
142 | - ) |
|
143 | - ), |
|
144 | - 'organization_address_1' => new EE_Text_Input( |
|
145 | - array( |
|
146 | - 'html_name' => 'organization_address_1', |
|
147 | - 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
|
148 | - 'default' => $this->organization_config->get_pretty('address_1'), |
|
149 | - 'required' => false, |
|
150 | - ) |
|
151 | - ), |
|
152 | - 'organization_address_2' => new EE_Text_Input( |
|
153 | - array( |
|
154 | - 'html_name' => 'organization_address_2', |
|
155 | - 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
|
156 | - 'default' => $this->organization_config->get_pretty('address_2'), |
|
157 | - 'required' => false, |
|
158 | - ) |
|
159 | - ), |
|
160 | - 'organization_city' => new EE_Text_Input( |
|
161 | - array( |
|
162 | - 'html_name' => 'organization_city', |
|
163 | - 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
164 | - 'default' => $this->organization_config->get_pretty('city'), |
|
165 | - 'required' => false, |
|
166 | - ) |
|
167 | - ), |
|
168 | - 'organization_country' => new EE_Country_Select_Input( |
|
169 | - null, |
|
170 | - array( |
|
171 | - EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL, |
|
172 | - 'html_name' => 'organization_country', |
|
173 | - 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
174 | - 'default' => $this->organization_config->CNT_ISO, |
|
175 | - 'required' => false, |
|
176 | - 'html_help_text' => sprintf( |
|
177 | - esc_html__( |
|
178 | - '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s', |
|
179 | - 'event_espresso' |
|
180 | - ), |
|
181 | - '<span class="reminder-spn">', |
|
182 | - '</span>' |
|
183 | - ), |
|
184 | - ) |
|
185 | - ), |
|
186 | - 'organization_state' => new EE_State_Select_Input( |
|
187 | - null, |
|
188 | - array( |
|
189 | - 'html_name' => 'organization_state', |
|
190 | - 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
|
191 | - 'default' => $this->organization_config->STA_ID, |
|
192 | - 'required' => false, |
|
193 | - 'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions |
|
194 | - ? sprintf( |
|
195 | - esc_html__( |
|
196 | - 'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s', |
|
197 | - 'event_espresso' |
|
198 | - ), |
|
199 | - '<span class="reminder-spn">', |
|
200 | - '</span>', |
|
201 | - '<br />' |
|
202 | - ) |
|
203 | - : '', |
|
204 | - ) |
|
205 | - ), |
|
206 | - 'organization_zip' => new EE_Text_Input( |
|
207 | - array( |
|
208 | - 'html_name' => 'organization_zip', |
|
209 | - 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
|
210 | - 'default' => $this->organization_config->get_pretty('zip'), |
|
211 | - 'required' => false, |
|
212 | - ) |
|
213 | - ), |
|
214 | - 'organization_email' => new EE_Text_Input( |
|
215 | - array( |
|
216 | - 'html_name' => 'organization_email', |
|
217 | - 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
|
218 | - 'html_help_text' => sprintf( |
|
219 | - esc_html__( |
|
220 | - 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
|
221 | - 'event_espresso' |
|
222 | - ), |
|
223 | - '<code>[CO_FORMATTED_EMAIL]</code>', |
|
224 | - '<code>[CO_EMAIL]</code>' |
|
225 | - ), |
|
226 | - 'default' => $this->organization_config->get_pretty('email'), |
|
227 | - 'required' => false, |
|
228 | - ) |
|
229 | - ), |
|
230 | - 'organization_phone' => new EE_Text_Input( |
|
231 | - array( |
|
232 | - 'html_name' => 'organization_phone', |
|
233 | - 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
234 | - 'html_help_text' => esc_html__( |
|
235 | - 'The phone number for your organization.', |
|
236 | - 'event_espresso' |
|
237 | - ), |
|
238 | - 'default' => $this->organization_config->get_pretty('phone'), |
|
239 | - 'required' => false, |
|
240 | - ) |
|
241 | - ), |
|
242 | - 'organization_vat' => new EE_Text_Input( |
|
243 | - array( |
|
244 | - 'html_name' => 'organization_vat', |
|
245 | - 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
|
246 | - 'html_help_text' => esc_html__( |
|
247 | - 'The VAT/Tax Number may be displayed on invoices and receipts.', |
|
248 | - 'event_espresso' |
|
249 | - ), |
|
250 | - 'default' => $this->organization_config->get_pretty('vat'), |
|
251 | - 'required' => false, |
|
252 | - ) |
|
253 | - ), |
|
254 | - 'company_logo_hdr' => new EE_Form_Section_HTML( |
|
255 | - EEH_HTML::h2( |
|
256 | - esc_html__('Company Logo', 'event_espresso') |
|
257 | - . ' ' |
|
258 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
|
259 | - '', |
|
260 | - 'company-logo-hdr' |
|
261 | - ) |
|
262 | - ), |
|
263 | - 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
|
264 | - array( |
|
265 | - 'html_name' => 'organization_logo_url', |
|
266 | - 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
|
267 | - 'html_help_text' => esc_html__( |
|
268 | - 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
269 | - 'event_espresso' |
|
270 | - ), |
|
271 | - 'default' => $this->organization_config->get_pretty('logo_url'), |
|
272 | - 'required' => false, |
|
273 | - ) |
|
274 | - ), |
|
275 | - 'social_links_hdr' => new EE_Form_Section_HTML( |
|
276 | - EEH_HTML::h2( |
|
277 | - esc_html__('Social Links', 'event_espresso') |
|
278 | - . ' ' |
|
279 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
|
280 | - . EEH_HTML::br() |
|
281 | - . EEH_HTML::p( |
|
282 | - esc_html__( |
|
283 | - 'Enter any links to social accounts for your organization here', |
|
284 | - 'event_espresso' |
|
285 | - ), |
|
286 | - '', |
|
287 | - 'description' |
|
288 | - ), |
|
289 | - '', |
|
290 | - 'social-links-hdr' |
|
291 | - ) |
|
292 | - ), |
|
293 | - 'organization_facebook' => new EE_Text_Input( |
|
294 | - array( |
|
295 | - 'html_name' => 'organization_facebook', |
|
296 | - 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
|
297 | - 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
|
298 | - 'default' => $this->organization_config->get_pretty('facebook'), |
|
299 | - 'required' => false, |
|
300 | - ) |
|
301 | - ), |
|
302 | - 'organization_twitter' => new EE_Text_Input( |
|
303 | - array( |
|
304 | - 'html_name' => 'organization_twitter', |
|
305 | - 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
|
306 | - 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
|
307 | - 'default' => $this->organization_config->get_pretty('twitter'), |
|
308 | - 'required' => false, |
|
309 | - ) |
|
310 | - ), |
|
311 | - 'organization_linkedin' => new EE_Text_Input( |
|
312 | - array( |
|
313 | - 'html_name' => 'organization_linkedin', |
|
314 | - 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
|
315 | - 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
|
316 | - 'default' => $this->organization_config->get_pretty('linkedin'), |
|
317 | - 'required' => false, |
|
318 | - ) |
|
319 | - ), |
|
320 | - 'organization_pinterest' => new EE_Text_Input( |
|
321 | - array( |
|
322 | - 'html_name' => 'organization_pinterest', |
|
323 | - 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
|
324 | - 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
|
325 | - 'default' => $this->organization_config->get_pretty('pinterest'), |
|
326 | - 'required' => false, |
|
327 | - ) |
|
328 | - ), |
|
329 | - 'organization_instagram' => new EE_Text_Input( |
|
330 | - array( |
|
331 | - 'html_name' => 'organization_instagram', |
|
332 | - 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
|
333 | - 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
|
334 | - 'default' => $this->organization_config->get_pretty('instagram'), |
|
335 | - 'required' => false, |
|
336 | - ) |
|
337 | - ), |
|
338 | - ), |
|
339 | - ) |
|
340 | - ); |
|
341 | - if (is_main_site()) { |
|
342 | - $form->add_subsections( |
|
343 | - array( |
|
344 | - 'site_license_key_hdr' => new EE_Form_Section_HTML( |
|
345 | - EEH_HTML::h2( |
|
346 | - esc_html__('Your Event Espresso License Key', 'event_espresso') |
|
347 | - . ' ' |
|
348 | - . EEH_HTML::span( |
|
349 | - EEH_Template::get_help_tab_link('site_license_key_info'), |
|
350 | - 'help_tour_activation' |
|
351 | - ), |
|
352 | - '', |
|
353 | - 'site-license-key-hdr' |
|
354 | - ) |
|
355 | - ), |
|
356 | - 'site_license_key' => $this->getSiteLicenseKeyField() |
|
357 | - ) |
|
358 | - ); |
|
359 | - $form->add_subsections( |
|
360 | - array( |
|
361 | - 'uxip_optin_hdr' => new EE_Form_Section_HTML( |
|
362 | - $this->uxipOptinText() |
|
363 | - ), |
|
364 | - 'ueip_optin' => new EE_Checkbox_Multi_Input( |
|
365 | - array( |
|
366 | - true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso') |
|
367 | - ), |
|
368 | - array( |
|
369 | - 'html_name' => EE_Core_Config::OPTION_NAME_UXIP, |
|
370 | - 'html_label_text' => esc_html__( |
|
371 | - 'UXIP Opt In?', |
|
372 | - 'event_espresso' |
|
373 | - ), |
|
374 | - 'default' => isset($this->core_config->ee_ueip_optin) |
|
375 | - ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN) |
|
376 | - : false, |
|
377 | - 'required' => false, |
|
378 | - ) |
|
379 | - ), |
|
380 | - ), |
|
381 | - 'organization_instagram', |
|
382 | - false |
|
383 | - ); |
|
384 | - } |
|
385 | - return $form; |
|
386 | - } |
|
102 | + /** |
|
103 | + * creates and returns the actual form |
|
104 | + * |
|
105 | + * @return EE_Form_Section_Proper |
|
106 | + * @throws EE_Error |
|
107 | + * @throws InvalidArgumentException |
|
108 | + * @throws InvalidDataTypeException |
|
109 | + * @throws InvalidInterfaceException |
|
110 | + * @throws ReflectionException |
|
111 | + */ |
|
112 | + public function generate() |
|
113 | + { |
|
114 | + $has_sub_regions = EEM_State::instance()->count( |
|
115 | + array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO)) |
|
116 | + ); |
|
117 | + $form = new EE_Form_Section_Proper( |
|
118 | + array( |
|
119 | + 'name' => 'organization_settings', |
|
120 | + 'html_id' => 'organization_settings', |
|
121 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
122 | + 'subsections' => array( |
|
123 | + 'contact_information_hdr' => new EE_Form_Section_HTML( |
|
124 | + EEH_HTML::h2( |
|
125 | + esc_html__('Contact Information', 'event_espresso') |
|
126 | + . ' ' |
|
127 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
|
128 | + '', |
|
129 | + 'contact-information-hdr' |
|
130 | + ) |
|
131 | + ), |
|
132 | + 'organization_name' => new EE_Text_Input( |
|
133 | + array( |
|
134 | + 'html_name' => 'organization_name', |
|
135 | + 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
|
136 | + 'html_help_text' => esc_html__( |
|
137 | + 'Displayed on all emails and invoices.', |
|
138 | + 'event_espresso' |
|
139 | + ), |
|
140 | + 'default' => $this->organization_config->get_pretty('name'), |
|
141 | + 'required' => false, |
|
142 | + ) |
|
143 | + ), |
|
144 | + 'organization_address_1' => new EE_Text_Input( |
|
145 | + array( |
|
146 | + 'html_name' => 'organization_address_1', |
|
147 | + 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
|
148 | + 'default' => $this->organization_config->get_pretty('address_1'), |
|
149 | + 'required' => false, |
|
150 | + ) |
|
151 | + ), |
|
152 | + 'organization_address_2' => new EE_Text_Input( |
|
153 | + array( |
|
154 | + 'html_name' => 'organization_address_2', |
|
155 | + 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
|
156 | + 'default' => $this->organization_config->get_pretty('address_2'), |
|
157 | + 'required' => false, |
|
158 | + ) |
|
159 | + ), |
|
160 | + 'organization_city' => new EE_Text_Input( |
|
161 | + array( |
|
162 | + 'html_name' => 'organization_city', |
|
163 | + 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
164 | + 'default' => $this->organization_config->get_pretty('city'), |
|
165 | + 'required' => false, |
|
166 | + ) |
|
167 | + ), |
|
168 | + 'organization_country' => new EE_Country_Select_Input( |
|
169 | + null, |
|
170 | + array( |
|
171 | + EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL, |
|
172 | + 'html_name' => 'organization_country', |
|
173 | + 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
174 | + 'default' => $this->organization_config->CNT_ISO, |
|
175 | + 'required' => false, |
|
176 | + 'html_help_text' => sprintf( |
|
177 | + esc_html__( |
|
178 | + '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s', |
|
179 | + 'event_espresso' |
|
180 | + ), |
|
181 | + '<span class="reminder-spn">', |
|
182 | + '</span>' |
|
183 | + ), |
|
184 | + ) |
|
185 | + ), |
|
186 | + 'organization_state' => new EE_State_Select_Input( |
|
187 | + null, |
|
188 | + array( |
|
189 | + 'html_name' => 'organization_state', |
|
190 | + 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
|
191 | + 'default' => $this->organization_config->STA_ID, |
|
192 | + 'required' => false, |
|
193 | + 'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions |
|
194 | + ? sprintf( |
|
195 | + esc_html__( |
|
196 | + 'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s', |
|
197 | + 'event_espresso' |
|
198 | + ), |
|
199 | + '<span class="reminder-spn">', |
|
200 | + '</span>', |
|
201 | + '<br />' |
|
202 | + ) |
|
203 | + : '', |
|
204 | + ) |
|
205 | + ), |
|
206 | + 'organization_zip' => new EE_Text_Input( |
|
207 | + array( |
|
208 | + 'html_name' => 'organization_zip', |
|
209 | + 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
|
210 | + 'default' => $this->organization_config->get_pretty('zip'), |
|
211 | + 'required' => false, |
|
212 | + ) |
|
213 | + ), |
|
214 | + 'organization_email' => new EE_Text_Input( |
|
215 | + array( |
|
216 | + 'html_name' => 'organization_email', |
|
217 | + 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
|
218 | + 'html_help_text' => sprintf( |
|
219 | + esc_html__( |
|
220 | + 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
|
221 | + 'event_espresso' |
|
222 | + ), |
|
223 | + '<code>[CO_FORMATTED_EMAIL]</code>', |
|
224 | + '<code>[CO_EMAIL]</code>' |
|
225 | + ), |
|
226 | + 'default' => $this->organization_config->get_pretty('email'), |
|
227 | + 'required' => false, |
|
228 | + ) |
|
229 | + ), |
|
230 | + 'organization_phone' => new EE_Text_Input( |
|
231 | + array( |
|
232 | + 'html_name' => 'organization_phone', |
|
233 | + 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
234 | + 'html_help_text' => esc_html__( |
|
235 | + 'The phone number for your organization.', |
|
236 | + 'event_espresso' |
|
237 | + ), |
|
238 | + 'default' => $this->organization_config->get_pretty('phone'), |
|
239 | + 'required' => false, |
|
240 | + ) |
|
241 | + ), |
|
242 | + 'organization_vat' => new EE_Text_Input( |
|
243 | + array( |
|
244 | + 'html_name' => 'organization_vat', |
|
245 | + 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
|
246 | + 'html_help_text' => esc_html__( |
|
247 | + 'The VAT/Tax Number may be displayed on invoices and receipts.', |
|
248 | + 'event_espresso' |
|
249 | + ), |
|
250 | + 'default' => $this->organization_config->get_pretty('vat'), |
|
251 | + 'required' => false, |
|
252 | + ) |
|
253 | + ), |
|
254 | + 'company_logo_hdr' => new EE_Form_Section_HTML( |
|
255 | + EEH_HTML::h2( |
|
256 | + esc_html__('Company Logo', 'event_espresso') |
|
257 | + . ' ' |
|
258 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
|
259 | + '', |
|
260 | + 'company-logo-hdr' |
|
261 | + ) |
|
262 | + ), |
|
263 | + 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
|
264 | + array( |
|
265 | + 'html_name' => 'organization_logo_url', |
|
266 | + 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
|
267 | + 'html_help_text' => esc_html__( |
|
268 | + 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
269 | + 'event_espresso' |
|
270 | + ), |
|
271 | + 'default' => $this->organization_config->get_pretty('logo_url'), |
|
272 | + 'required' => false, |
|
273 | + ) |
|
274 | + ), |
|
275 | + 'social_links_hdr' => new EE_Form_Section_HTML( |
|
276 | + EEH_HTML::h2( |
|
277 | + esc_html__('Social Links', 'event_espresso') |
|
278 | + . ' ' |
|
279 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
|
280 | + . EEH_HTML::br() |
|
281 | + . EEH_HTML::p( |
|
282 | + esc_html__( |
|
283 | + 'Enter any links to social accounts for your organization here', |
|
284 | + 'event_espresso' |
|
285 | + ), |
|
286 | + '', |
|
287 | + 'description' |
|
288 | + ), |
|
289 | + '', |
|
290 | + 'social-links-hdr' |
|
291 | + ) |
|
292 | + ), |
|
293 | + 'organization_facebook' => new EE_Text_Input( |
|
294 | + array( |
|
295 | + 'html_name' => 'organization_facebook', |
|
296 | + 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
|
297 | + 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
|
298 | + 'default' => $this->organization_config->get_pretty('facebook'), |
|
299 | + 'required' => false, |
|
300 | + ) |
|
301 | + ), |
|
302 | + 'organization_twitter' => new EE_Text_Input( |
|
303 | + array( |
|
304 | + 'html_name' => 'organization_twitter', |
|
305 | + 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
|
306 | + 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
|
307 | + 'default' => $this->organization_config->get_pretty('twitter'), |
|
308 | + 'required' => false, |
|
309 | + ) |
|
310 | + ), |
|
311 | + 'organization_linkedin' => new EE_Text_Input( |
|
312 | + array( |
|
313 | + 'html_name' => 'organization_linkedin', |
|
314 | + 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
|
315 | + 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
|
316 | + 'default' => $this->organization_config->get_pretty('linkedin'), |
|
317 | + 'required' => false, |
|
318 | + ) |
|
319 | + ), |
|
320 | + 'organization_pinterest' => new EE_Text_Input( |
|
321 | + array( |
|
322 | + 'html_name' => 'organization_pinterest', |
|
323 | + 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
|
324 | + 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
|
325 | + 'default' => $this->organization_config->get_pretty('pinterest'), |
|
326 | + 'required' => false, |
|
327 | + ) |
|
328 | + ), |
|
329 | + 'organization_instagram' => new EE_Text_Input( |
|
330 | + array( |
|
331 | + 'html_name' => 'organization_instagram', |
|
332 | + 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
|
333 | + 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
|
334 | + 'default' => $this->organization_config->get_pretty('instagram'), |
|
335 | + 'required' => false, |
|
336 | + ) |
|
337 | + ), |
|
338 | + ), |
|
339 | + ) |
|
340 | + ); |
|
341 | + if (is_main_site()) { |
|
342 | + $form->add_subsections( |
|
343 | + array( |
|
344 | + 'site_license_key_hdr' => new EE_Form_Section_HTML( |
|
345 | + EEH_HTML::h2( |
|
346 | + esc_html__('Your Event Espresso License Key', 'event_espresso') |
|
347 | + . ' ' |
|
348 | + . EEH_HTML::span( |
|
349 | + EEH_Template::get_help_tab_link('site_license_key_info'), |
|
350 | + 'help_tour_activation' |
|
351 | + ), |
|
352 | + '', |
|
353 | + 'site-license-key-hdr' |
|
354 | + ) |
|
355 | + ), |
|
356 | + 'site_license_key' => $this->getSiteLicenseKeyField() |
|
357 | + ) |
|
358 | + ); |
|
359 | + $form->add_subsections( |
|
360 | + array( |
|
361 | + 'uxip_optin_hdr' => new EE_Form_Section_HTML( |
|
362 | + $this->uxipOptinText() |
|
363 | + ), |
|
364 | + 'ueip_optin' => new EE_Checkbox_Multi_Input( |
|
365 | + array( |
|
366 | + true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso') |
|
367 | + ), |
|
368 | + array( |
|
369 | + 'html_name' => EE_Core_Config::OPTION_NAME_UXIP, |
|
370 | + 'html_label_text' => esc_html__( |
|
371 | + 'UXIP Opt In?', |
|
372 | + 'event_espresso' |
|
373 | + ), |
|
374 | + 'default' => isset($this->core_config->ee_ueip_optin) |
|
375 | + ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN) |
|
376 | + : false, |
|
377 | + 'required' => false, |
|
378 | + ) |
|
379 | + ), |
|
380 | + ), |
|
381 | + 'organization_instagram', |
|
382 | + false |
|
383 | + ); |
|
384 | + } |
|
385 | + return $form; |
|
386 | + } |
|
387 | 387 | |
388 | 388 | |
389 | - /** |
|
390 | - * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
391 | - * returns a string of HTML that can be directly echoed in a template |
|
392 | - * |
|
393 | - * @return string |
|
394 | - * @throws EE_Error |
|
395 | - * @throws InvalidArgumentException |
|
396 | - * @throws InvalidDataTypeException |
|
397 | - * @throws InvalidInterfaceException |
|
398 | - * @throws LogicException |
|
399 | - */ |
|
400 | - public function display() |
|
401 | - { |
|
402 | - $this->form()->enqueue_js(); |
|
403 | - return parent::display(); |
|
404 | - } |
|
389 | + /** |
|
390 | + * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
391 | + * returns a string of HTML that can be directly echoed in a template |
|
392 | + * |
|
393 | + * @return string |
|
394 | + * @throws EE_Error |
|
395 | + * @throws InvalidArgumentException |
|
396 | + * @throws InvalidDataTypeException |
|
397 | + * @throws InvalidInterfaceException |
|
398 | + * @throws LogicException |
|
399 | + */ |
|
400 | + public function display() |
|
401 | + { |
|
402 | + $this->form()->enqueue_js(); |
|
403 | + return parent::display(); |
|
404 | + } |
|
405 | 405 | |
406 | 406 | |
407 | - /** |
|
408 | - * handles processing the form submission |
|
409 | - * returns true or false depending on whether the form was processed successfully or not |
|
410 | - * |
|
411 | - * @param array $form_data |
|
412 | - * @return bool |
|
413 | - * @throws InvalidFormSubmissionException |
|
414 | - * @throws EE_Error |
|
415 | - * @throws LogicException |
|
416 | - * @throws InvalidArgumentException |
|
417 | - * @throws InvalidDataTypeException |
|
418 | - * @throws ReflectionException |
|
419 | - */ |
|
420 | - public function process($form_data = array()) |
|
421 | - { |
|
422 | - // process form |
|
423 | - $valid_data = (array) parent::process($form_data); |
|
424 | - if (empty($valid_data)) { |
|
425 | - return false; |
|
426 | - } |
|
407 | + /** |
|
408 | + * handles processing the form submission |
|
409 | + * returns true or false depending on whether the form was processed successfully or not |
|
410 | + * |
|
411 | + * @param array $form_data |
|
412 | + * @return bool |
|
413 | + * @throws InvalidFormSubmissionException |
|
414 | + * @throws EE_Error |
|
415 | + * @throws LogicException |
|
416 | + * @throws InvalidArgumentException |
|
417 | + * @throws InvalidDataTypeException |
|
418 | + * @throws ReflectionException |
|
419 | + */ |
|
420 | + public function process($form_data = array()) |
|
421 | + { |
|
422 | + // process form |
|
423 | + $valid_data = (array) parent::process($form_data); |
|
424 | + if (empty($valid_data)) { |
|
425 | + return false; |
|
426 | + } |
|
427 | 427 | |
428 | - if (is_main_site()) { |
|
429 | - $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key']) |
|
430 | - ? sanitize_text_field($form_data['ee_site_license_key']) |
|
431 | - : $this->network_core_config->site_license_key; |
|
432 | - } |
|
433 | - $this->organization_config->name = isset($form_data['organization_name']) |
|
434 | - ? sanitize_text_field($form_data['organization_name']) |
|
435 | - : $this->organization_config->name; |
|
436 | - $this->organization_config->address_1 = isset($form_data['organization_address_1']) |
|
437 | - ? sanitize_text_field($form_data['organization_address_1']) |
|
438 | - : $this->organization_config->address_1; |
|
439 | - $this->organization_config->address_2 = isset($form_data['organization_address_2']) |
|
440 | - ? sanitize_text_field($form_data['organization_address_2']) |
|
441 | - : $this->organization_config->address_2; |
|
442 | - $this->organization_config->city = isset($form_data['organization_city']) |
|
443 | - ? sanitize_text_field($form_data['organization_city']) |
|
444 | - : $this->organization_config->city; |
|
445 | - $this->organization_config->STA_ID = isset($form_data['organization_state']) |
|
446 | - ? absint($form_data['organization_state']) |
|
447 | - : $this->organization_config->STA_ID; |
|
448 | - $this->organization_config->CNT_ISO = isset($form_data['organization_country']) |
|
449 | - ? sanitize_text_field($form_data['organization_country']) |
|
450 | - : $this->organization_config->CNT_ISO; |
|
451 | - $this->organization_config->zip = isset($form_data['organization_zip']) |
|
452 | - ? sanitize_text_field($form_data['organization_zip']) |
|
453 | - : $this->organization_config->zip; |
|
454 | - $this->organization_config->email = isset($form_data['organization_email']) |
|
455 | - ? sanitize_email($form_data['organization_email']) |
|
456 | - : $this->organization_config->email; |
|
457 | - $this->organization_config->vat = isset($form_data['organization_vat']) |
|
458 | - ? sanitize_text_field($form_data['organization_vat']) |
|
459 | - : $this->organization_config->vat; |
|
460 | - $this->organization_config->phone = isset($form_data['organization_phone']) |
|
461 | - ? sanitize_text_field($form_data['organization_phone']) |
|
462 | - : $this->organization_config->phone; |
|
463 | - $this->organization_config->logo_url = isset($form_data['organization_logo_url']) |
|
464 | - ? esc_url_raw($form_data['organization_logo_url']) |
|
465 | - : $this->organization_config->logo_url; |
|
466 | - $this->organization_config->facebook = isset($form_data['organization_facebook']) |
|
467 | - ? esc_url_raw($form_data['organization_facebook']) |
|
468 | - : $this->organization_config->facebook; |
|
469 | - $this->organization_config->twitter = isset($form_data['organization_twitter']) |
|
470 | - ? esc_url_raw($form_data['organization_twitter']) |
|
471 | - : $this->organization_config->twitter; |
|
472 | - $this->organization_config->linkedin = isset($form_data['organization_linkedin']) |
|
473 | - ? esc_url_raw($form_data['organization_linkedin']) |
|
474 | - : $this->organization_config->linkedin; |
|
475 | - $this->organization_config->pinterest = isset($form_data['organization_pinterest']) |
|
476 | - ? esc_url_raw($form_data['organization_pinterest']) |
|
477 | - : $this->organization_config->pinterest; |
|
478 | - $this->organization_config->google = isset($form_data['organization_google']) |
|
479 | - ? esc_url_raw($form_data['organization_google']) |
|
480 | - : $this->organization_config->google; |
|
481 | - $this->organization_config->instagram = isset($form_data['organization_instagram']) |
|
482 | - ? esc_url_raw($form_data['organization_instagram']) |
|
483 | - : $this->organization_config->instagram; |
|
484 | - $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
485 | - ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
486 | - : false; |
|
487 | - $this->core_config->ee_ueip_has_notified = true; |
|
428 | + if (is_main_site()) { |
|
429 | + $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key']) |
|
430 | + ? sanitize_text_field($form_data['ee_site_license_key']) |
|
431 | + : $this->network_core_config->site_license_key; |
|
432 | + } |
|
433 | + $this->organization_config->name = isset($form_data['organization_name']) |
|
434 | + ? sanitize_text_field($form_data['organization_name']) |
|
435 | + : $this->organization_config->name; |
|
436 | + $this->organization_config->address_1 = isset($form_data['organization_address_1']) |
|
437 | + ? sanitize_text_field($form_data['organization_address_1']) |
|
438 | + : $this->organization_config->address_1; |
|
439 | + $this->organization_config->address_2 = isset($form_data['organization_address_2']) |
|
440 | + ? sanitize_text_field($form_data['organization_address_2']) |
|
441 | + : $this->organization_config->address_2; |
|
442 | + $this->organization_config->city = isset($form_data['organization_city']) |
|
443 | + ? sanitize_text_field($form_data['organization_city']) |
|
444 | + : $this->organization_config->city; |
|
445 | + $this->organization_config->STA_ID = isset($form_data['organization_state']) |
|
446 | + ? absint($form_data['organization_state']) |
|
447 | + : $this->organization_config->STA_ID; |
|
448 | + $this->organization_config->CNT_ISO = isset($form_data['organization_country']) |
|
449 | + ? sanitize_text_field($form_data['organization_country']) |
|
450 | + : $this->organization_config->CNT_ISO; |
|
451 | + $this->organization_config->zip = isset($form_data['organization_zip']) |
|
452 | + ? sanitize_text_field($form_data['organization_zip']) |
|
453 | + : $this->organization_config->zip; |
|
454 | + $this->organization_config->email = isset($form_data['organization_email']) |
|
455 | + ? sanitize_email($form_data['organization_email']) |
|
456 | + : $this->organization_config->email; |
|
457 | + $this->organization_config->vat = isset($form_data['organization_vat']) |
|
458 | + ? sanitize_text_field($form_data['organization_vat']) |
|
459 | + : $this->organization_config->vat; |
|
460 | + $this->organization_config->phone = isset($form_data['organization_phone']) |
|
461 | + ? sanitize_text_field($form_data['organization_phone']) |
|
462 | + : $this->organization_config->phone; |
|
463 | + $this->organization_config->logo_url = isset($form_data['organization_logo_url']) |
|
464 | + ? esc_url_raw($form_data['organization_logo_url']) |
|
465 | + : $this->organization_config->logo_url; |
|
466 | + $this->organization_config->facebook = isset($form_data['organization_facebook']) |
|
467 | + ? esc_url_raw($form_data['organization_facebook']) |
|
468 | + : $this->organization_config->facebook; |
|
469 | + $this->organization_config->twitter = isset($form_data['organization_twitter']) |
|
470 | + ? esc_url_raw($form_data['organization_twitter']) |
|
471 | + : $this->organization_config->twitter; |
|
472 | + $this->organization_config->linkedin = isset($form_data['organization_linkedin']) |
|
473 | + ? esc_url_raw($form_data['organization_linkedin']) |
|
474 | + : $this->organization_config->linkedin; |
|
475 | + $this->organization_config->pinterest = isset($form_data['organization_pinterest']) |
|
476 | + ? esc_url_raw($form_data['organization_pinterest']) |
|
477 | + : $this->organization_config->pinterest; |
|
478 | + $this->organization_config->google = isset($form_data['organization_google']) |
|
479 | + ? esc_url_raw($form_data['organization_google']) |
|
480 | + : $this->organization_config->google; |
|
481 | + $this->organization_config->instagram = isset($form_data['organization_instagram']) |
|
482 | + ? esc_url_raw($form_data['organization_instagram']) |
|
483 | + : $this->organization_config->instagram; |
|
484 | + $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
485 | + ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
486 | + : false; |
|
487 | + $this->core_config->ee_ueip_has_notified = true; |
|
488 | 488 | |
489 | - $this->registry->CFG->currency = new EE_Currency_Config( |
|
490 | - $this->organization_config->CNT_ISO |
|
491 | - ); |
|
492 | - /** @var EE_Country $country */ |
|
493 | - $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO); |
|
494 | - if ($country instanceof EE_Country) { |
|
495 | - $country->set('CNT_active', 1); |
|
496 | - $country->save(); |
|
497 | - $this->countrySubRegionDao->saveCountrySubRegions($country); |
|
498 | - } |
|
499 | - return true; |
|
500 | - } |
|
489 | + $this->registry->CFG->currency = new EE_Currency_Config( |
|
490 | + $this->organization_config->CNT_ISO |
|
491 | + ); |
|
492 | + /** @var EE_Country $country */ |
|
493 | + $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO); |
|
494 | + if ($country instanceof EE_Country) { |
|
495 | + $country->set('CNT_active', 1); |
|
496 | + $country->save(); |
|
497 | + $this->countrySubRegionDao->saveCountrySubRegions($country); |
|
498 | + } |
|
499 | + return true; |
|
500 | + } |
|
501 | 501 | |
502 | 502 | |
503 | - /** |
|
504 | - * @return string |
|
505 | - */ |
|
506 | - private function uxipOptinText() |
|
507 | - { |
|
508 | - ob_start(); |
|
509 | - Stats::optinText(false); |
|
510 | - return ob_get_clean(); |
|
511 | - } |
|
503 | + /** |
|
504 | + * @return string |
|
505 | + */ |
|
506 | + private function uxipOptinText() |
|
507 | + { |
|
508 | + ob_start(); |
|
509 | + Stats::optinText(false); |
|
510 | + return ob_get_clean(); |
|
511 | + } |
|
512 | 512 | |
513 | 513 | |
514 | - /** |
|
515 | - * Return whether the site license key has been verified or not. |
|
516 | - * @return bool |
|
517 | - */ |
|
518 | - private function licenseKeyVerified() |
|
519 | - { |
|
520 | - if (empty($this->network_core_config->site_license_key)) { |
|
521 | - return false; |
|
522 | - } |
|
523 | - $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
524 | - $verify_fail = get_option($ver_option_key, false); |
|
525 | - return $verify_fail === false |
|
526 | - || (! empty($this->network_core_config->site_license_key) |
|
527 | - && $verify_fail === false |
|
528 | - ); |
|
529 | - } |
|
514 | + /** |
|
515 | + * Return whether the site license key has been verified or not. |
|
516 | + * @return bool |
|
517 | + */ |
|
518 | + private function licenseKeyVerified() |
|
519 | + { |
|
520 | + if (empty($this->network_core_config->site_license_key)) { |
|
521 | + return false; |
|
522 | + } |
|
523 | + $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
524 | + $verify_fail = get_option($ver_option_key, false); |
|
525 | + return $verify_fail === false |
|
526 | + || (! empty($this->network_core_config->site_license_key) |
|
527 | + && $verify_fail === false |
|
528 | + ); |
|
529 | + } |
|
530 | 530 | |
531 | 531 | |
532 | - /** |
|
533 | - * @return EE_Text_Input |
|
534 | - */ |
|
535 | - private function getSiteLicenseKeyField() |
|
536 | - { |
|
537 | - $text_input = new EE_Text_Input( |
|
538 | - array( |
|
539 | - 'html_name' => 'ee_site_license_key', |
|
540 | - 'html_id' => 'site_license_key', |
|
541 | - 'html_label_text' => esc_html__('Support License Key', 'event_espresso'), |
|
542 | - /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */ |
|
543 | - 'html_help_text' => sprintf( |
|
544 | - esc_html__( |
|
545 | - 'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', |
|
546 | - 'event_espresso' |
|
547 | - ), |
|
548 | - '<strong>', |
|
549 | - '</strong>' |
|
550 | - ), |
|
551 | - /** phpcs:enable */ |
|
552 | - 'default' => isset($this->network_core_config->site_license_key) |
|
553 | - ? $this->network_core_config->site_license_key |
|
554 | - : '', |
|
555 | - 'required' => false, |
|
556 | - 'form_html_filter' => new VsprintfFilter( |
|
557 | - '%2$s %1$s', |
|
558 | - array($this->getValidationIndicator()) |
|
559 | - ) |
|
560 | - ) |
|
561 | - ); |
|
562 | - return $text_input; |
|
563 | - } |
|
532 | + /** |
|
533 | + * @return EE_Text_Input |
|
534 | + */ |
|
535 | + private function getSiteLicenseKeyField() |
|
536 | + { |
|
537 | + $text_input = new EE_Text_Input( |
|
538 | + array( |
|
539 | + 'html_name' => 'ee_site_license_key', |
|
540 | + 'html_id' => 'site_license_key', |
|
541 | + 'html_label_text' => esc_html__('Support License Key', 'event_espresso'), |
|
542 | + /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */ |
|
543 | + 'html_help_text' => sprintf( |
|
544 | + esc_html__( |
|
545 | + 'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', |
|
546 | + 'event_espresso' |
|
547 | + ), |
|
548 | + '<strong>', |
|
549 | + '</strong>' |
|
550 | + ), |
|
551 | + /** phpcs:enable */ |
|
552 | + 'default' => isset($this->network_core_config->site_license_key) |
|
553 | + ? $this->network_core_config->site_license_key |
|
554 | + : '', |
|
555 | + 'required' => false, |
|
556 | + 'form_html_filter' => new VsprintfFilter( |
|
557 | + '%2$s %1$s', |
|
558 | + array($this->getValidationIndicator()) |
|
559 | + ) |
|
560 | + ) |
|
561 | + ); |
|
562 | + return $text_input; |
|
563 | + } |
|
564 | 564 | |
565 | 565 | |
566 | - /** |
|
567 | - * @return string |
|
568 | - */ |
|
569 | - private function getValidationIndicator() |
|
570 | - { |
|
571 | - $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red'; |
|
572 | - return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>'; |
|
573 | - } |
|
566 | + /** |
|
567 | + * @return string |
|
568 | + */ |
|
569 | + private function getValidationIndicator() |
|
570 | + { |
|
571 | + $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red'; |
|
572 | + return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>'; |
|
573 | + } |
|
574 | 574 | } |
@@ -11,61 +11,61 @@ |
||
11 | 11 | class EE_Radio_Button_Display_Strategy extends EE_Compound_Input_Display_Strategy |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * |
|
16 | - * @throws EE_Error |
|
17 | - * @return string of html to display the field |
|
18 | - */ |
|
19 | - public function display() |
|
20 | - { |
|
21 | - $input = $this->get_input(); |
|
22 | - $input->set_label_sizes(); |
|
23 | - $label_size_class = $input->get_label_size_class(); |
|
24 | - $html = ''; |
|
25 | - foreach ($input->options() as $value => $display_text) { |
|
26 | - $value = $input->get_normalization_strategy()->unnormalize($value); |
|
14 | + /** |
|
15 | + * |
|
16 | + * @throws EE_Error |
|
17 | + * @return string of html to display the field |
|
18 | + */ |
|
19 | + public function display() |
|
20 | + { |
|
21 | + $input = $this->get_input(); |
|
22 | + $input->set_label_sizes(); |
|
23 | + $label_size_class = $input->get_label_size_class(); |
|
24 | + $html = ''; |
|
25 | + foreach ($input->options() as $value => $display_text) { |
|
26 | + $value = $input->get_normalization_strategy()->unnormalize($value); |
|
27 | 27 | |
28 | - $html_id = $this->get_sub_input_id($value); |
|
29 | - $html .= EEH_HTML::nl(0, 'radio'); |
|
28 | + $html_id = $this->get_sub_input_id($value); |
|
29 | + $html .= EEH_HTML::nl(0, 'radio'); |
|
30 | 30 | |
31 | - $html .= $this->_opening_tag('label'); |
|
32 | - $html .= $this->_attributes_string( |
|
33 | - array( |
|
34 | - 'for' => $html_id, |
|
35 | - 'id' => $html_id . '-lbl', |
|
36 | - 'class' => apply_filters( |
|
37 | - 'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class', |
|
38 | - 'ee-radio-label-after' . $label_size_class, |
|
39 | - $this, |
|
40 | - $input, |
|
41 | - $value |
|
42 | - ) |
|
43 | - ) |
|
44 | - ); |
|
45 | - $html .= '>'; |
|
46 | - $html .= EEH_HTML::nl(1, 'radio'); |
|
47 | - $html .= $this->_opening_tag('input'); |
|
48 | - $attributes = array( |
|
49 | - 'id' => $html_id, |
|
50 | - 'name' => $input->html_name(), |
|
51 | - 'class' => $input->html_class(), |
|
52 | - 'style' => $input->html_style(), |
|
53 | - 'type' => 'radio', |
|
54 | - 'value' => $value, |
|
55 | - 0 => $input->other_html_attributes(), |
|
56 | - 'data-question_label' => $input->html_label_id() |
|
57 | - ); |
|
58 | - if ($input->raw_value() === $value) { |
|
59 | - $attributes['checked'] = 'checked'; |
|
60 | - } |
|
61 | - $html .= $this->_attributes_string($attributes); |
|
31 | + $html .= $this->_opening_tag('label'); |
|
32 | + $html .= $this->_attributes_string( |
|
33 | + array( |
|
34 | + 'for' => $html_id, |
|
35 | + 'id' => $html_id . '-lbl', |
|
36 | + 'class' => apply_filters( |
|
37 | + 'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class', |
|
38 | + 'ee-radio-label-after' . $label_size_class, |
|
39 | + $this, |
|
40 | + $input, |
|
41 | + $value |
|
42 | + ) |
|
43 | + ) |
|
44 | + ); |
|
45 | + $html .= '>'; |
|
46 | + $html .= EEH_HTML::nl(1, 'radio'); |
|
47 | + $html .= $this->_opening_tag('input'); |
|
48 | + $attributes = array( |
|
49 | + 'id' => $html_id, |
|
50 | + 'name' => $input->html_name(), |
|
51 | + 'class' => $input->html_class(), |
|
52 | + 'style' => $input->html_style(), |
|
53 | + 'type' => 'radio', |
|
54 | + 'value' => $value, |
|
55 | + 0 => $input->other_html_attributes(), |
|
56 | + 'data-question_label' => $input->html_label_id() |
|
57 | + ); |
|
58 | + if ($input->raw_value() === $value) { |
|
59 | + $attributes['checked'] = 'checked'; |
|
60 | + } |
|
61 | + $html .= $this->_attributes_string($attributes); |
|
62 | 62 | |
63 | - $html .= '> '; |
|
64 | - $html .= $display_text; |
|
65 | - $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; |
|
66 | - } |
|
67 | - $html .= EEH_HTML::div('', '', 'clear-float'); |
|
68 | - $html .= EEH_HTML::divx(); |
|
69 | - return apply_filters('FHEE__EE_Radio_Button_Display_Strategy__display', $html, $this, $this->_input); |
|
70 | - } |
|
63 | + $html .= '> '; |
|
64 | + $html .= $display_text; |
|
65 | + $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; |
|
66 | + } |
|
67 | + $html .= EEH_HTML::div('', '', 'clear-float'); |
|
68 | + $html .= EEH_HTML::divx(); |
|
69 | + return apply_filters('FHEE__EE_Radio_Button_Display_Strategy__display', $html, $this, $this->_input); |
|
70 | + } |
|
71 | 71 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $html .= $this->_attributes_string( |
33 | 33 | array( |
34 | 34 | 'for' => $html_id, |
35 | - 'id' => $html_id . '-lbl', |
|
35 | + 'id' => $html_id.'-lbl', |
|
36 | 36 | 'class' => apply_filters( |
37 | 37 | 'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class', |
38 | - 'ee-radio-label-after' . $label_size_class, |
|
38 | + 'ee-radio-label-after'.$label_size_class, |
|
39 | 39 | $this, |
40 | 40 | $input, |
41 | 41 | $value |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $html .= '> '; |
64 | 64 | $html .= $display_text; |
65 | - $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; |
|
65 | + $html .= EEH_HTML::nl(-1, 'radio').'</label>'; |
|
66 | 66 | } |
67 | 67 | $html .= EEH_HTML::div('', '', 'clear-float'); |
68 | 68 | $html .= EEH_HTML::divx(); |
@@ -16,74 +16,74 @@ |
||
16 | 16 | class EraseAttendeeData implements PersonalDataEraserInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var EEM_Attendee |
|
21 | - */ |
|
22 | - protected $attendee_model; |
|
19 | + /** |
|
20 | + * @var EEM_Attendee |
|
21 | + */ |
|
22 | + protected $attendee_model; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * EraseAttendeeData constructor. |
|
27 | - * |
|
28 | - * @param EEM_Attendee $attendee_model |
|
29 | - */ |
|
30 | - public function __construct(EEM_Attendee $attendee_model) |
|
31 | - { |
|
32 | - $this->attendee_model = $attendee_model; |
|
33 | - } |
|
25 | + /** |
|
26 | + * EraseAttendeeData constructor. |
|
27 | + * |
|
28 | + * @param EEM_Attendee $attendee_model |
|
29 | + */ |
|
30 | + public function __construct(EEM_Attendee $attendee_model) |
|
31 | + { |
|
32 | + $this->attendee_model = $attendee_model; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * Gets a translated string name for the data eraser |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function name() |
|
42 | - { |
|
43 | - return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
44 | - } |
|
36 | + /** |
|
37 | + * Gets a translated string name for the data eraser |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function name() |
|
42 | + { |
|
43 | + return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Erases a "page" of personal user data |
|
49 | - * |
|
50 | - * @return array { |
|
51 | - * @type boolean $items_removed whether items were removed successfully or not |
|
52 | - * @type boolean $items_retained whether any items were skipped or not |
|
53 | - * @type array $messages values are messages to show |
|
54 | - * @type boolean $done whether this eraser is done or has more pages |
|
55 | - * } |
|
56 | - * @throws \EE_Error |
|
57 | - */ |
|
58 | - public function erase($email_address, $page = 1) |
|
59 | - { |
|
60 | - $rows_updated = $this->attendee_model->update( |
|
61 | - array( |
|
62 | - 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
63 | - 'ATT_lname' => '', |
|
64 | - 'ATT_email' => '', |
|
65 | - 'ATT_address' => '', |
|
66 | - 'ATT_address2' => '', |
|
67 | - 'ATT_city' => '', |
|
68 | - 'STA_ID' => 0, |
|
69 | - 'CNT_ISO' => '', |
|
70 | - 'ATT_zip' => '', |
|
71 | - 'ATT_phone' => '', |
|
72 | - ), |
|
73 | - array( |
|
74 | - array( |
|
75 | - 'ATT_email' => $email_address, |
|
76 | - ), |
|
77 | - ) |
|
78 | - ); |
|
47 | + /** |
|
48 | + * Erases a "page" of personal user data |
|
49 | + * |
|
50 | + * @return array { |
|
51 | + * @type boolean $items_removed whether items were removed successfully or not |
|
52 | + * @type boolean $items_retained whether any items were skipped or not |
|
53 | + * @type array $messages values are messages to show |
|
54 | + * @type boolean $done whether this eraser is done or has more pages |
|
55 | + * } |
|
56 | + * @throws \EE_Error |
|
57 | + */ |
|
58 | + public function erase($email_address, $page = 1) |
|
59 | + { |
|
60 | + $rows_updated = $this->attendee_model->update( |
|
61 | + array( |
|
62 | + 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
63 | + 'ATT_lname' => '', |
|
64 | + 'ATT_email' => '', |
|
65 | + 'ATT_address' => '', |
|
66 | + 'ATT_address2' => '', |
|
67 | + 'ATT_city' => '', |
|
68 | + 'STA_ID' => 0, |
|
69 | + 'CNT_ISO' => '', |
|
70 | + 'ATT_zip' => '', |
|
71 | + 'ATT_phone' => '', |
|
72 | + ), |
|
73 | + array( |
|
74 | + array( |
|
75 | + 'ATT_email' => $email_address, |
|
76 | + ), |
|
77 | + ) |
|
78 | + ); |
|
79 | 79 | |
80 | - return array( |
|
81 | - 'items_removed' => (bool) $rows_updated, |
|
82 | - 'items_retained' => false, // always false in this example |
|
83 | - 'messages' => array(), |
|
84 | - 'done' => true, |
|
85 | - ); |
|
86 | - } |
|
80 | + return array( |
|
81 | + 'items_removed' => (bool) $rows_updated, |
|
82 | + 'items_retained' => false, // always false in this example |
|
83 | + 'messages' => array(), |
|
84 | + 'done' => true, |
|
85 | + ); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | // End of file EraseAttendeeData.php |
89 | 89 | // Location: EventEspresso\core\domain\services\privacy\erasure/EraseAttendeeData.php |
@@ -17,89 +17,89 @@ |
||
17 | 17 | class EE_Restriction_Generator_Event_Related_Protected extends EE_Restriction_Generator_Base |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Path to the event model from the model this restriction generator will be applied to; |
|
22 | - * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_path_to_event_model = null; |
|
20 | + /** |
|
21 | + * Path to the event model from the model this restriction generator will be applied to; |
|
22 | + * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_path_to_event_model = null; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Capability context on event model when creating restrictions. |
|
29 | - * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
30 | - * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
31 | - * EDIT EVENTS in order to DELETE DATETIMES. |
|
32 | - * @var string one of EEM_Base::valid_cap_contexts() |
|
33 | - */ |
|
34 | - protected $_cap_context_on_event_model = null; |
|
35 | - /** |
|
36 | - * |
|
37 | - * @param string $path_to_event_model |
|
38 | - * @param string $cap_context_on_event_model capability context on event model when creating restrictions. |
|
39 | - * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
40 | - * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
41 | - * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same |
|
42 | - * as on the primary model. |
|
43 | - */ |
|
44 | - public function __construct($path_to_event_model, $cap_context_on_event_model = null) |
|
45 | - { |
|
46 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
47 | - $path_to_event_model .= '.'; |
|
48 | - } |
|
49 | - $this->_path_to_event_model = $path_to_event_model; |
|
50 | - $this->_cap_context_on_event_model = $cap_context_on_event_model; |
|
51 | - } |
|
27 | + /** |
|
28 | + * Capability context on event model when creating restrictions. |
|
29 | + * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
30 | + * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
31 | + * EDIT EVENTS in order to DELETE DATETIMES. |
|
32 | + * @var string one of EEM_Base::valid_cap_contexts() |
|
33 | + */ |
|
34 | + protected $_cap_context_on_event_model = null; |
|
35 | + /** |
|
36 | + * |
|
37 | + * @param string $path_to_event_model |
|
38 | + * @param string $cap_context_on_event_model capability context on event model when creating restrictions. |
|
39 | + * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
40 | + * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
41 | + * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same |
|
42 | + * as on the primary model. |
|
43 | + */ |
|
44 | + public function __construct($path_to_event_model, $cap_context_on_event_model = null) |
|
45 | + { |
|
46 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
47 | + $path_to_event_model .= '.'; |
|
48 | + } |
|
49 | + $this->_path_to_event_model = $path_to_event_model; |
|
50 | + $this->_cap_context_on_event_model = $cap_context_on_event_model; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Returns `$this->_cap_context_on_event_model`, the relevant action ("read", |
|
55 | - * "read_admin", "edit" or "delete") for the EVENT related to this model. |
|
56 | - * @see EE_Restriction_Generator_Event_Related_Protected::__construct() |
|
57 | - * @return string one of EEM_Base::valid_cap_contexts() |
|
58 | - */ |
|
59 | - protected function action_for_event() |
|
60 | - { |
|
61 | - if ($this->_cap_context_on_event_model) { |
|
62 | - return $this->_cap_context_on_event_model; |
|
63 | - } else { |
|
64 | - return $this->action(); |
|
65 | - } |
|
66 | - } |
|
53 | + /** |
|
54 | + * Returns `$this->_cap_context_on_event_model`, the relevant action ("read", |
|
55 | + * "read_admin", "edit" or "delete") for the EVENT related to this model. |
|
56 | + * @see EE_Restriction_Generator_Event_Related_Protected::__construct() |
|
57 | + * @return string one of EEM_Base::valid_cap_contexts() |
|
58 | + */ |
|
59 | + protected function action_for_event() |
|
60 | + { |
|
61 | + if ($this->_cap_context_on_event_model) { |
|
62 | + return $this->_cap_context_on_event_model; |
|
63 | + } else { |
|
64 | + return $this->action(); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * |
|
70 | - * @return \EE_Default_Where_Conditions |
|
71 | - */ |
|
72 | - protected function _generate_restrictions() |
|
73 | - { |
|
74 | - // if there are no standard caps for this model, then for now all we know |
|
75 | - // if they need the default cap to access this |
|
76 | - if (! $this->model()->cap_slug()) { |
|
77 | - return array( |
|
78 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
79 | - ); |
|
80 | - } |
|
68 | + /** |
|
69 | + * |
|
70 | + * @return \EE_Default_Where_Conditions |
|
71 | + */ |
|
72 | + protected function _generate_restrictions() |
|
73 | + { |
|
74 | + // if there are no standard caps for this model, then for now all we know |
|
75 | + // if they need the default cap to access this |
|
76 | + if (! $this->model()->cap_slug()) { |
|
77 | + return array( |
|
78 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - $event_model = EEM_Event::instance(); |
|
83 | - return array( |
|
84 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
85 | - // if they don't have the basic event cap, they can't access ANY non-default items |
|
86 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
|
87 | - // if they don't have the others event cap, they can't access others' non-default items |
|
88 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | - array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
90 | - ), |
|
91 | - // if they have basic and others, but not private, they can't access others' private non-default items |
|
92 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
93 | - array( |
|
94 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
95 | - array( |
|
96 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | - ), |
|
98 | - false, |
|
99 | - $this->_path_to_event_model |
|
100 | - ) |
|
101 | - ) |
|
102 | - ), |
|
103 | - ); |
|
104 | - } |
|
82 | + $event_model = EEM_Event::instance(); |
|
83 | + return array( |
|
84 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
85 | + // if they don't have the basic event cap, they can't access ANY non-default items |
|
86 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
|
87 | + // if they don't have the others event cap, they can't access others' non-default items |
|
88 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | + array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
90 | + ), |
|
91 | + // if they have basic and others, but not private, they can't access others' private non-default items |
|
92 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
93 | + array( |
|
94 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
95 | + array( |
|
96 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | + ), |
|
98 | + false, |
|
99 | + $this->_path_to_event_model |
|
100 | + ) |
|
101 | + ) |
|
102 | + ), |
|
103 | + ); |
|
104 | + } |
|
105 | 105 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | // if there are no standard caps for this model, then for now all we know |
75 | 75 | // if they need the default cap to access this |
76 | - if (! $this->model()->cap_slug()) { |
|
76 | + if ( ! $this->model()->cap_slug()) { |
|
77 | 77 | return array( |
78 | 78 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
79 | 79 | ); |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | // if they don't have the basic event cap, they can't access ANY non-default items |
86 | 86 | EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
87 | 87 | // if they don't have the others event cap, they can't access others' non-default items |
88 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | - array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
88 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_others') => new EE_Default_Where_Conditions( |
|
89 | + array($this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder) |
|
90 | 90 | ), |
91 | 91 | // if they have basic and others, but not private, they can't access others' private non-default items |
92 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => new EE_Default_Where_Conditions( |
|
93 | 93 | array( |
94 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
94 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => $this->addPublishedPostConditions( |
|
95 | 95 | array( |
96 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | 97 | ), |
98 | 98 | false, |
99 | 99 | $this->_path_to_event_model |
@@ -17,72 +17,72 @@ |
||
17 | 17 | class EE_Restriction_Generator_Event_Related_Public extends EE_Restriction_Generator_Base |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Path to the event model from the model this restriction generator will be applied to; |
|
22 | - * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_path_to_event_model; |
|
26 | - /** |
|
27 | - * |
|
28 | - * @param string $path_to_event_model |
|
29 | - */ |
|
30 | - public function __construct($path_to_event_model) |
|
31 | - { |
|
32 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
33 | - $path_to_event_model .= '.'; |
|
34 | - } |
|
35 | - $this->_path_to_event_model = $path_to_event_model; |
|
36 | - } |
|
37 | - /** |
|
38 | - * |
|
39 | - * @return \EE_Default_Where_Conditions |
|
40 | - */ |
|
41 | - protected function _generate_restrictions() |
|
42 | - { |
|
43 | - // if there are no standard caps for this model, then for now all we know |
|
44 | - // if they need the default cap to access this |
|
45 | - if (! $this->model()->cap_slug()) { |
|
46 | - return array( |
|
47 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
48 | - ); |
|
49 | - } |
|
20 | + /** |
|
21 | + * Path to the event model from the model this restriction generator will be applied to; |
|
22 | + * including the event model itself. Eg "Ticket.Datetime.Event" |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_path_to_event_model; |
|
26 | + /** |
|
27 | + * |
|
28 | + * @param string $path_to_event_model |
|
29 | + */ |
|
30 | + public function __construct($path_to_event_model) |
|
31 | + { |
|
32 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
33 | + $path_to_event_model .= '.'; |
|
34 | + } |
|
35 | + $this->_path_to_event_model = $path_to_event_model; |
|
36 | + } |
|
37 | + /** |
|
38 | + * |
|
39 | + * @return \EE_Default_Where_Conditions |
|
40 | + */ |
|
41 | + protected function _generate_restrictions() |
|
42 | + { |
|
43 | + // if there are no standard caps for this model, then for now all we know |
|
44 | + // if they need the default cap to access this |
|
45 | + if (! $this->model()->cap_slug()) { |
|
46 | + return array( |
|
47 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
48 | + ); |
|
49 | + } |
|
50 | 50 | |
51 | - $event_model = EEM_Event::instance(); |
|
52 | - return array( |
|
53 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
54 | - // if they don't have the basic event cap, they can only read things for published events |
|
55 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions( |
|
56 | - $this->addPublishedPostConditions( |
|
57 | - array(), |
|
58 | - true, |
|
59 | - $this->_path_to_event_model |
|
60 | - ) |
|
61 | - ), |
|
62 | - // if they don't have the others event cap, they can't access others' non-default items |
|
63 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
64 | - array( |
|
65 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
66 | - array( |
|
67 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | - ), |
|
69 | - true, |
|
70 | - $this->_path_to_event_model |
|
71 | - ) |
|
72 | - ) |
|
73 | - ), |
|
74 | - // if they have basic and others, but not private, they can't access others' private non-default items |
|
75 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
76 | - array( |
|
77 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
78 | - array( |
|
79 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | - ), |
|
81 | - false, |
|
82 | - $this->_path_to_event_model |
|
83 | - ) |
|
84 | - ) |
|
85 | - ), |
|
86 | - ); |
|
87 | - } |
|
51 | + $event_model = EEM_Event::instance(); |
|
52 | + return array( |
|
53 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
54 | + // if they don't have the basic event cap, they can only read things for published events |
|
55 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions( |
|
56 | + $this->addPublishedPostConditions( |
|
57 | + array(), |
|
58 | + true, |
|
59 | + $this->_path_to_event_model |
|
60 | + ) |
|
61 | + ), |
|
62 | + // if they don't have the others event cap, they can't access others' non-default items |
|
63 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
64 | + array( |
|
65 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
66 | + array( |
|
67 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | + ), |
|
69 | + true, |
|
70 | + $this->_path_to_event_model |
|
71 | + ) |
|
72 | + ) |
|
73 | + ), |
|
74 | + // if they have basic and others, but not private, they can't access others' private non-default items |
|
75 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
76 | + array( |
|
77 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
78 | + array( |
|
79 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | + ), |
|
81 | + false, |
|
82 | + $this->_path_to_event_model |
|
83 | + ) |
|
84 | + ) |
|
85 | + ), |
|
86 | + ); |
|
87 | + } |
|
88 | 88 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | // if there are no standard caps for this model, then for now all we know |
44 | 44 | // if they need the default cap to access this |
45 | - if (! $this->model()->cap_slug()) { |
|
45 | + if ( ! $this->model()->cap_slug()) { |
|
46 | 46 | return array( |
47 | 47 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
48 | 48 | ); |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ), |
62 | 62 | // if they don't have the others event cap, they can't access others' non-default items |
63 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
63 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions( |
|
64 | 64 | array( |
65 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
65 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => $this->addPublishedPostConditions( |
|
66 | 66 | array( |
67 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
67 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | 68 | ), |
69 | 69 | true, |
70 | 70 | $this->_path_to_event_model |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | ) |
73 | 73 | ), |
74 | 74 | // if they have basic and others, but not private, they can't access others' private non-default items |
75 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
75 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions( |
|
76 | 76 | array( |
77 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
77 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => $this->addPublishedPostConditions( |
|
78 | 78 | array( |
79 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
79 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | 80 | ), |
81 | 81 | false, |
82 | 82 | $this->_path_to_event_model |
@@ -12,74 +12,74 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Restriction_Generator_Public extends EE_Restriction_Generator_Base |
14 | 14 | { |
15 | - protected function _generate_restrictions() |
|
16 | - { |
|
17 | - // if there are no standard caps for this model, then for allow full access |
|
18 | - if (! $this->model()->cap_slug()) { |
|
19 | - return array( |
|
20 | - ); |
|
21 | - } |
|
15 | + protected function _generate_restrictions() |
|
16 | + { |
|
17 | + // if there are no standard caps for this model, then for allow full access |
|
18 | + if (! $this->model()->cap_slug()) { |
|
19 | + return array( |
|
20 | + ); |
|
21 | + } |
|
22 | 22 | |
23 | - $restrictions = array(); |
|
24 | - // does the basic cap exist? (eg 'ee_read_registrations') |
|
25 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
|
26 | - if ($this->model() instanceof EEM_CPT_Base) { |
|
27 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
28 | - $this->addPublishedPostConditions() |
|
29 | - ); |
|
30 | - } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
31 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | - array( $this->model()->deleted_field_name() => false ) |
|
33 | - ); |
|
34 | - } else { |
|
35 | - // don't impose any restrictions if they don't have the basic reading cap |
|
36 | - } |
|
37 | - // does the others cap exist? (eg 'ee_read_others_registrations') |
|
38 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
39 | - if ($this->model() instanceof EEM_CPT_Base) { |
|
40 | - // then if they don't have the others cap, AT MOST show them their own and other published ones |
|
41 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
42 | - array( |
|
43 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
44 | - array( |
|
45 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
46 | - ) |
|
47 | - ) |
|
48 | - ) |
|
49 | - ); |
|
50 | - } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
51 | - // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
|
52 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
53 | - array( |
|
54 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
55 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
56 | - $this->model()->deleted_field_name() => false |
|
57 | - ) |
|
58 | - ) |
|
59 | - ); |
|
60 | - } else { |
|
61 | - // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
|
62 | - } |
|
63 | - // does the private cap exist (eg 'ee_read_others_private_events') |
|
64 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | - // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
|
66 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
67 | - array( |
|
68 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
69 | - array( |
|
70 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
71 | - ), |
|
72 | - false, |
|
73 | - '' |
|
74 | - ) |
|
75 | - ) |
|
76 | - ); |
|
77 | - } |
|
78 | - } |
|
79 | - } else { |
|
80 | - // there is no basic cap. So allow full access |
|
81 | - $restrictions = array(); |
|
82 | - } |
|
83 | - return $restrictions; |
|
84 | - } |
|
23 | + $restrictions = array(); |
|
24 | + // does the basic cap exist? (eg 'ee_read_registrations') |
|
25 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
|
26 | + if ($this->model() instanceof EEM_CPT_Base) { |
|
27 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
28 | + $this->addPublishedPostConditions() |
|
29 | + ); |
|
30 | + } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
31 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | + array( $this->model()->deleted_field_name() => false ) |
|
33 | + ); |
|
34 | + } else { |
|
35 | + // don't impose any restrictions if they don't have the basic reading cap |
|
36 | + } |
|
37 | + // does the others cap exist? (eg 'ee_read_others_registrations') |
|
38 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
39 | + if ($this->model() instanceof EEM_CPT_Base) { |
|
40 | + // then if they don't have the others cap, AT MOST show them their own and other published ones |
|
41 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
42 | + array( |
|
43 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
44 | + array( |
|
45 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
46 | + ) |
|
47 | + ) |
|
48 | + ) |
|
49 | + ); |
|
50 | + } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
51 | + // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
|
52 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
53 | + array( |
|
54 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
55 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
56 | + $this->model()->deleted_field_name() => false |
|
57 | + ) |
|
58 | + ) |
|
59 | + ); |
|
60 | + } else { |
|
61 | + // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
|
62 | + } |
|
63 | + // does the private cap exist (eg 'ee_read_others_private_events') |
|
64 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | + // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
|
66 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
67 | + array( |
|
68 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
69 | + array( |
|
70 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
71 | + ), |
|
72 | + false, |
|
73 | + '' |
|
74 | + ) |
|
75 | + ) |
|
76 | + ); |
|
77 | + } |
|
78 | + } |
|
79 | + } else { |
|
80 | + // there is no basic cap. So allow full access |
|
81 | + $restrictions = array(); |
|
82 | + } |
|
83 | + return $restrictions; |
|
84 | + } |
|
85 | 85 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | protected function _generate_restrictions() |
16 | 16 | { |
17 | 17 | // if there are no standard caps for this model, then for allow full access |
18 | - if (! $this->model()->cap_slug()) { |
|
18 | + if ( ! $this->model()->cap_slug()) { |
|
19 | 19 | return array( |
20 | 20 | ); |
21 | 21 | } |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | // does the basic cap exist? (eg 'ee_read_registrations') |
25 | 25 | if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
26 | 26 | if ($this->model() instanceof EEM_CPT_Base) { |
27 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
27 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions( |
|
28 | 28 | $this->addPublishedPostConditions() |
29 | 29 | ); |
30 | 30 | } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
31 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | - array( $this->model()->deleted_field_name() => false ) |
|
31 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions( |
|
32 | + array($this->model()->deleted_field_name() => false) |
|
33 | 33 | ); |
34 | 34 | } else { |
35 | 35 | // don't impose any restrictions if they don't have the basic reading cap |
36 | 36 | } |
37 | 37 | // does the others cap exist? (eg 'ee_read_others_registrations') |
38 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
38 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others')) {// both caps exist |
|
39 | 39 | if ($this->model() instanceof EEM_CPT_Base) { |
40 | 40 | // then if they don't have the others cap, AT MOST show them their own and other published ones |
41 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
41 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions( |
|
42 | 42 | array( |
43 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
43 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => $this->addPublishedPostConditions( |
|
44 | 44 | array( |
45 | 45 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
46 | 46 | ) |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
51 | 51 | // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
52 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
52 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions( |
|
53 | 53 | array( |
54 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
54 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => array( |
|
55 | 55 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
56 | 56 | $this->model()->deleted_field_name() => false |
57 | 57 | ) |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
62 | 62 | } |
63 | 63 | // does the private cap exist (eg 'ee_read_others_private_events') |
64 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
64 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | 65 | // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
66 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
66 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private')] = new EE_Default_Where_Conditions( |
|
67 | 67 | array( |
68 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
68 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private') => $this->addPublishedPostConditions( |
|
69 | 69 | array( |
70 | 70 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
71 | 71 | ), |
@@ -18,110 +18,110 @@ |
||
18 | 18 | class EE_Restriction_Generator_Default_Public extends EE_Restriction_Generator_Base |
19 | 19 | { |
20 | 20 | /** |
21 | - * Name of the field on this model (or a related model, including the model chain to it) |
|
22 | - * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_default_field_name; |
|
21 | + * Name of the field on this model (or a related model, including the model chain to it) |
|
22 | + * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_default_field_name; |
|
26 | 26 | |
27 | - /** |
|
28 | - * The model chain to follow to get to the event model, including the event model itself. |
|
29 | - * Eg 'Ticket.Datetime.Event' |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - protected $_path_to_event_model; |
|
33 | - /** |
|
34 | - * |
|
35 | - * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it) |
|
36 | - * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
37 | - * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself. |
|
38 | - * Eg 'Ticket.Datetime.Event' |
|
39 | - */ |
|
40 | - public function __construct($default_field_name, $path_to_event_model) |
|
41 | - { |
|
42 | - $this->_default_field_name = $default_field_name; |
|
43 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
44 | - $path_to_event_model .= '.'; |
|
45 | - } |
|
46 | - $this->_path_to_event_model = $path_to_event_model; |
|
47 | - } |
|
27 | + /** |
|
28 | + * The model chain to follow to get to the event model, including the event model itself. |
|
29 | + * Eg 'Ticket.Datetime.Event' |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + protected $_path_to_event_model; |
|
33 | + /** |
|
34 | + * |
|
35 | + * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it) |
|
36 | + * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
37 | + * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself. |
|
38 | + * Eg 'Ticket.Datetime.Event' |
|
39 | + */ |
|
40 | + public function __construct($default_field_name, $path_to_event_model) |
|
41 | + { |
|
42 | + $this->_default_field_name = $default_field_name; |
|
43 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
44 | + $path_to_event_model .= '.'; |
|
45 | + } |
|
46 | + $this->_path_to_event_model = $path_to_event_model; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return EE_Default_Where_Conditions |
|
51 | - * @throws EE_Error |
|
52 | - */ |
|
53 | - protected function _generate_restrictions() |
|
54 | - { |
|
55 | - // if there are no standard caps for this model, then for now all we know |
|
56 | - // if they need the default cap to access this |
|
57 | - if (!$this->model()->cap_slug()) { |
|
58 | - return array( |
|
59 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
60 | - ); |
|
61 | - } |
|
49 | + /** |
|
50 | + * @return EE_Default_Where_Conditions |
|
51 | + * @throws EE_Error |
|
52 | + */ |
|
53 | + protected function _generate_restrictions() |
|
54 | + { |
|
55 | + // if there are no standard caps for this model, then for now all we know |
|
56 | + // if they need the default cap to access this |
|
57 | + if (!$this->model()->cap_slug()) { |
|
58 | + return array( |
|
59 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - $event_model = EEM_Event::instance(); |
|
63 | + $event_model = EEM_Event::instance(); |
|
64 | 64 | |
65 | - $restrictions = array( |
|
66 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
67 | - // if they don't have the basic event cap, they can't access ANY non-default items |
|
68 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
|
69 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | - array( |
|
71 | - $this->_default_field_name => true, |
|
72 | - ), |
|
73 | - true, |
|
74 | - $this->_path_to_event_model |
|
75 | - ) |
|
76 | - )), |
|
77 | - // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
|
78 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
79 | - array( |
|
80 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
81 | - array( |
|
82 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | - $this->_default_field_name => true, |
|
84 | - ), |
|
85 | - true, |
|
86 | - $this->_path_to_event_model |
|
87 | - ) |
|
88 | - ) |
|
89 | - ), |
|
90 | - // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
|
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
92 | - array( |
|
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
94 | - array( |
|
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | - $this->_default_field_name => true |
|
97 | - ), |
|
98 | - false, |
|
99 | - $this->_path_to_event_model |
|
100 | - ) |
|
101 | - ) |
|
102 | - ), |
|
103 | - // second: access to defaults is controlled by the default capabilities |
|
104 | - // if they don't have the basic default capability, restrict access to only non-default items |
|
105 | - EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | - array( $this->_default_field_name => false ) |
|
107 | - ), |
|
108 | - ); |
|
109 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
110 | - // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
|
111 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
112 | - array( |
|
113 | - // if they don't have the others default cap, they can't access others default items (but they can access |
|
114 | - // their own default items, and non-default items) |
|
115 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
116 | - 'AND' => array( |
|
117 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
118 | - $this->_default_field_name => true |
|
119 | - ), |
|
120 | - $this->_default_field_name => false |
|
121 | - ) |
|
122 | - ) |
|
123 | - ); |
|
124 | - } |
|
125 | - return $restrictions; |
|
126 | - } |
|
65 | + $restrictions = array( |
|
66 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
67 | + // if they don't have the basic event cap, they can't access ANY non-default items |
|
68 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
|
69 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | + array( |
|
71 | + $this->_default_field_name => true, |
|
72 | + ), |
|
73 | + true, |
|
74 | + $this->_path_to_event_model |
|
75 | + ) |
|
76 | + )), |
|
77 | + // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
|
78 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
79 | + array( |
|
80 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
81 | + array( |
|
82 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | + $this->_default_field_name => true, |
|
84 | + ), |
|
85 | + true, |
|
86 | + $this->_path_to_event_model |
|
87 | + ) |
|
88 | + ) |
|
89 | + ), |
|
90 | + // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + array( |
|
93 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
94 | + array( |
|
95 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + $this->_default_field_name => true |
|
97 | + ), |
|
98 | + false, |
|
99 | + $this->_path_to_event_model |
|
100 | + ) |
|
101 | + ) |
|
102 | + ), |
|
103 | + // second: access to defaults is controlled by the default capabilities |
|
104 | + // if they don't have the basic default capability, restrict access to only non-default items |
|
105 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | + array( $this->_default_field_name => false ) |
|
107 | + ), |
|
108 | + ); |
|
109 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
110 | + // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
|
111 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
112 | + array( |
|
113 | + // if they don't have the others default cap, they can't access others default items (but they can access |
|
114 | + // their own default items, and non-default items) |
|
115 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
116 | + 'AND' => array( |
|
117 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
118 | + $this->_default_field_name => true |
|
119 | + ), |
|
120 | + $this->_default_field_name => false |
|
121 | + ) |
|
122 | + ) |
|
123 | + ); |
|
124 | + } |
|
125 | + return $restrictions; |
|
126 | + } |
|
127 | 127 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | // if there are no standard caps for this model, then for now all we know |
56 | 56 | // if they need the default cap to access this |
57 | - if (!$this->model()->cap_slug()) { |
|
57 | + if ( ! $this->model()->cap_slug()) { |
|
58 | 58 | return array( |
59 | 59 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
60 | 60 | ); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // first: basically access to non-defaults is essentially controlled by which events are accessible |
67 | 67 | // if they don't have the basic event cap, they can't access ANY non-default items |
68 | 68 | EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
69 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
69 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | 70 | array( |
71 | 71 | $this->_default_field_name => true, |
72 | 72 | ), |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | ) |
76 | 76 | )), |
77 | 77 | // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
78 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
78 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions( |
|
79 | 79 | array( |
80 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
80 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => $this->addPublishedPostConditions( |
|
81 | 81 | array( |
82 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
82 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | 83 | $this->_default_field_name => true, |
84 | 84 | ), |
85 | 85 | true, |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions( |
|
92 | 92 | array( |
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
93 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => $this->addPublishedPostConditions( |
|
94 | 94 | array( |
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
95 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | 96 | $this->_default_field_name => true |
97 | 97 | ), |
98 | 98 | false, |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | ), |
103 | 103 | // second: access to defaults is controlled by the default capabilities |
104 | 104 | // if they don't have the basic default capability, restrict access to only non-default items |
105 | - EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | - array( $this->_default_field_name => false ) |
|
105 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_default') => new EE_Default_Where_Conditions( |
|
106 | + array($this->_default_field_name => false) |
|
107 | 107 | ), |
108 | 108 | ); |
109 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
109 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others_default')) { |
|
110 | 110 | // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
111 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
111 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default')] = new EE_Default_Where_Conditions( |
|
112 | 112 | array( |
113 | 113 | // if they don't have the others default cap, they can't access others default items (but they can access |
114 | 114 | // their own default items, and non-default items) |
115 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
115 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default') => array( |
|
116 | 116 | 'AND' => array( |
117 | 117 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
118 | 118 | $this->_default_field_name => true |