PluginProbe
Elementor Website Builder – more than just a page builder / 3.11.5
Elementor Website Builder – more than just a page builder v3.11.5
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / core / common / modules / connect / apps / base-app.php

base-app.php in Elementor Website Builder – more than just a page builder 3.11.5, at core/common/modules/connect/apps/base-app.php

824 lines 19.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Common\Modules\Connect\Apps;
3
4 use Elementor\Core\Admin\Admin_Notices;
5 use Elementor\Core\Common\Modules\Connect\Admin;
6 use Elementor\Core\Utils\Collection;
7 use Elementor\Core\Utils\Http;
8 use Elementor\Core\Utils\Str;
9 use Elementor\Plugin;
10 use Elementor\Tracker;
11 use Elementor\Utils;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly
15 }
16
17 abstract class Base_App {
18
19 const OPTION_NAME_PREFIX = 'elementor_connect_';
20
21 const OPTION_CONNECT_SITE_KEY = self::OPTION_NAME_PREFIX . 'site_key';
22
23 const SITE_URL = 'https://my.elementor.com/connect/v1';
24
25 const API_URL = 'https://my.elementor.com/api/connect/v1';
26
27 const HTTP_RETURN_TYPE_OBJECT = 'object';
28 const HTTP_RETURN_TYPE_ARRAY = 'array';
29
30 protected $data = [];
31
32 protected $auth_mode = '';
33
34 /**
35 * @var Http
36 */
37 protected $http;
38
39 /**
40 * @since 2.3.0
41 * @access protected
42 * @abstract
43 * TODO: make it public.
44 */
45 abstract protected function get_slug();
46
47 /**
48 * @since 2.8.0
49 * @access public
50 * TODO: make it abstract.
51 */
52 public function get_title() {
53 return $this->get_slug();
54 }
55
56 /**
57 * @since 2.3.0
58 * @access protected
59 * @abstract
60 */
61 abstract protected function update_settings();
62
63 /**
64 * @since 2.3.0
65 * @access public
66 * @static
67 */
68 public static function get_class_name() {
69 return get_called_class();
70 }
71
72 /**
73 * @access public
74 * @abstract
75 */
76 public function render_admin_widget() {
77 // PHPCS - the method get_title return a plain string.
78 echo '<h2>' . $this->get_title() . '</h2>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
79
80 if ( $this->is_connected() ) {
81 $remote_user = $this->get( 'user' );
82 /* translators: %s: Remote user. */
83 $title = sprintf( esc_html__( 'Connected as %s', 'elementor' ), '<strong>' . esc_html( $remote_user->email ) . '</strong>' );
84 $label = esc_html__( 'Disconnect', 'elementor' );
85 $url = $this->get_admin_url( 'disconnect' );
86 $attr = '';
87
88 echo sprintf(
89 '%s <a %s href="%s">%s</a>',
90 // PHPCS - the variable $title is already escaped above.
91 $title, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
92 // PHPCS - the variable $attr is a plain string.
93 $attr, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
94 esc_attr( $url ),
95 esc_html( $label )
96 );
97 } else {
98 echo 'Not Connected';
99 }
100
101 echo '<hr>';
102
103 $this->print_app_info();
104
105 if ( current_user_can( 'manage_options' ) ) {
106 printf( '<div><a href="%s">%s</a></div>', esc_url( $this->get_admin_url( 'reset' ) ), esc_html__( 'Reset Data', 'elementor' ) );
107 }
108
109 echo '<hr>';
110 }
111
112
113 /**
114 * @since 2.3.0
115 * @access protected
116 */
117 protected function get_option_name() {
118 return static::OPTION_NAME_PREFIX . $this->get_slug();
119 }
120
121 /**
122 * @since 2.3.0
123 * @access public
124 */
125 public function admin_notice() {
126 $notices = $this->get( 'notices' );
127
128 if ( ! $notices ) {
129 return;
130 }
131
132 $this->print_notices( $notices );
133
134 $this->delete( 'notices' );
135 }
136
137
138 public function get_app_token_from_cli_token( $cli_token ) {
139 $response = $this->request( 'get_app_token_from_cli_token', [
140 'cli_token' => $cli_token,
141 ] );
142
143 if ( is_wp_error( $response ) ) {
144 // PHPCS - the variable $response does not contain a user input value.
145 wp_die( $response, $response->get_error_message() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
146 }
147
148 // Use state as usual.
149 $_REQUEST['state'] = $this->get( 'state' );
150 $_REQUEST['code'] = $response->code;
151 }
152 /**
153 * @since 2.3.0
154 * @access public
155 */
156 public function action_authorize() {
157 if ( $this->is_connected() ) {
158 $this->add_notice( esc_html__( 'Already connected.', 'elementor' ), 'info' );
159 $this->redirect_to_admin_page();
160 return;
161 }
162
163 $this->set_client_id();
164 $this->set_request_state();
165
166 $this->redirect_to_remote_authorize_url();
167 }
168
169 public function action_reset() {
170 if ( current_user_can( 'manage_options' ) ) {
171 delete_option( static::OPTION_CONNECT_SITE_KEY );
172 delete_option( 'elementor_remote_info_library' );
173 }
174
175 $this->redirect_to_admin_page();
176 }
177
178 /**
179 * @since 2.3.0
180 * @access public
181 */
182 public function action_get_token() {
183 if ( $this->is_connected() ) {
184 $this->redirect_to_admin_page();
185 }
186
187 //phpcs:ignore WordPress.Security.NonceVerification.Recommended - The user as been authorized before in 'connect'.
188 $state = Utils::get_super_global_value( $_REQUEST, 'state' );
189
190 if ( $state !== $this->get( 'state' ) ) {
191 $this->add_notice( 'Get Token: Invalid Request.', 'error' );
192 $this->redirect_to_admin_page();
193 }
194
195 $response = $this->request( 'get_token', [
196 'grant_type' => 'authorization_code',
197 'code' => Utils::get_super_global_value( $_REQUEST, 'code' ), //phpcs:ignore WordPress.Security.NonceVerification.Recommended
198 'redirect_uri' => rawurlencode( $this->get_admin_url( 'get_token' ) ),
199 'client_id' => $this->get( 'client_id' ),
200 ] );
201
202 if ( is_wp_error( $response ) ) {
203 $notice = 'Cannot Get Token:' . $response->get_error_message();
204 $this->add_notice( $notice, 'error' );
205 $this->redirect_to_admin_page();
206 }
207
208 $this->delete( 'state' );
209 $this->set( (array) $response );
210
211 if ( ! empty( $response->data_share_opted_in ) && current_user_can( 'manage_options' ) ) {
212 Tracker::set_opt_in( true );
213 }
214
215 $this->after_connect();
216
217 // Add the notice *after* the method `after_connect`, so an app can redirect without the notice.
218 $this->add_notice( esc_html__( 'Connected successfully.', 'elementor' ) );
219
220 $this->redirect_to_admin_page();
221 }
222
223 /**
224 * @since 2.3.0
225 * @access public
226 */
227 public function action_disconnect() {
228 if ( $this->is_connected() ) {
229 $this->disconnect();
230 $this->add_notice( esc_html__( 'Disconnected successfully.', 'elementor' ) );
231 }
232
233 $this->redirect_to_admin_page();
234 }
235
236 /**
237 * @since 2.8.0
238 * @access public
239 */
240 public function action_reconnect() {
241 $this->disconnect();
242
243 $this->action_authorize();
244 }
245
246 /**
247 * @since 2.3.0
248 * @access public
249 */
250 public function get_admin_url( $action, $params = [] ) {
251 $params = [
252 'app' => $this->get_slug(),
253 'action' => $action,
254 'nonce' => wp_create_nonce( $this->get_slug() . $action ),
255 ] + $params;
256
257 $admin_url = Str::encode_idn_url( get_admin_url() );
258 $admin_url .= 'admin.php?page=' . Admin::PAGE_ID;
259
260 return add_query_arg( $params, $admin_url );
261 }
262
263 /**
264 * @since 2.3.0
265 * @access public
266 */
267 public function is_connected() {
268 return (bool) $this->get( 'access_token' );
269 }
270
271 /**
272 * @since 2.3.0
273 * @access protected
274 */
275 protected function init() {}
276
277 /**
278 * @since 2.3.0
279 * @access protected
280 */
281 protected function init_data() {}
282
283 /**
284 * @since 2.3.0
285 * @access protected
286 */
287 protected function after_connect() {}
288
289 /**
290 * @since 2.3.0
291 * @access public
292 */
293 public function get( $key, $default = null ) {
294 $this->init_data();
295
296 return isset( $this->data[ $key ] ) ? $this->data[ $key ] : $default;
297 }
298
299 /**
300 * @since 2.3.0
301 * @access protected
302 */
303 protected function set( $key, $value = null ) {
304 $this->init_data();
305
306 if ( is_array( $key ) ) {
307 $this->data = array_replace_recursive( $this->data, $key );
308 } else {
309 $this->data[ $key ] = $value;
310 }
311
312 $this->update_settings();
313 }
314
315 /**
316 * @since 2.3.0
317 * @access protected
318 */
319 protected function delete( $key = null ) {
320 $this->init_data();
321
322 if ( $key ) {
323 unset( $this->data[ $key ] );
324 } else {
325 $this->data = [];
326 }
327
328 $this->update_settings();
329 }
330
331 /**
332 * @since 2.3.0
333 * @access protected
334 */
335 protected function add( $key, $value, $default = '' ) {
336 $new_value = $this->get( $key, $default );
337
338 if ( is_array( $new_value ) ) {
339 $new_value[] = $value;
340 } elseif ( is_string( $new_value ) ) {
341 $new_value .= $value;
342 } elseif ( is_numeric( $new_value ) ) {
343 $new_value += $value;
344 }
345
346 $this->set( $key, $new_value );
347 }
348
349 /**
350 * @since 2.3.0
351 * @access protected
352 */
353 protected function add_notice( $content, $type = 'success' ) {
354 $this->add( 'notices', compact( 'content', 'type' ), [] );
355 }
356
357 /**
358 * @param $action
359 * @param array $request_body
360 * @param false $as_array
361 *
362 * @return mixed|\WP_Error
363 */
364 protected function request( $action, $request_body = [], $as_array = false ) {
365 $request_body = $this->get_connect_info() + $request_body;
366
367 return $this->http_request(
368 'POST',
369 $action,
370 [
371 'timeout' => 25,
372 'body' => $request_body,
373 'headers' => $this->is_connected() ?
374 [ 'X-Elementor-Signature' => $this->generate_signature( $request_body ) ] :
375 [],
376 ],
377 [
378 'return_type' => $as_array ? static::HTTP_RETURN_TYPE_ARRAY : static::HTTP_RETURN_TYPE_OBJECT,
379 ]
380 );
381 }
382
383 /**
384 * Get Base Connect Info
385 *
386 * Returns an array of connect info.
387 *
388 * @return array
389 */
390 protected function get_base_connect_info() {
391 return [
392 'app' => $this->get_slug(),
393 'access_token' => $this->get( 'access_token' ),
394 'client_id' => $this->get( 'client_id' ),
395 'local_id' => get_current_user_id(),
396 'site_key' => $this->get_site_key(),
397 'home_url' => trailingslashit( home_url() ),
398 ];
399 }
400
401 /**
402 * Get all the connect information
403 *
404 * @return array
405 */
406 protected function get_connect_info() {
407 $connect_info = $this->get_base_connect_info();
408
409 $additional_info = [];
410
411 /**
412 * Additional connect info.
413 *
414 * Filters the connection information when connecting to Elementor servers.
415 * This hook can be used to add more information or add more data.
416 *
417 * @param array $additional_info Additional connecting information array.
418 * @param Base_App $this The base app instance.
419 */
420 $additional_info = apply_filters( 'elementor/connect/additional-connect-info', $additional_info, $this );
421
422 return array_merge( $connect_info, $additional_info );
423 }
424
425 /**
426 * @param $endpoint
427 *
428 * @return array
429 */
430 protected function generate_authentication_headers( $endpoint ) {
431 $connect_info = ( new Collection( $this->get_connect_info() ) )
432 ->map_with_keys( function ( $value, $key ) {
433 // For bc `get_connect_info` returns the connect info with underscore,
434 // headers with underscore are not valid, so all the keys with underscore will be replaced to hyphen.
435 return [ str_replace( '_', '-', $key ) => $value ];
436 } )
437 ->replace_recursive( [ 'endpoint' => $endpoint ] )
438 ->sort_keys();
439
440 return $connect_info
441 ->merge( [ 'X-Elementor-Signature' => $this->generate_signature( $connect_info->all() ) ] )
442 ->all();
443 }
444
445 /**
446 * Send an http request
447 *
448 * @param $method
449 * @param $endpoint
450 * @param array $args
451 * @param array $options
452 *
453 * @return mixed|\WP_Error
454 */
455 protected function http_request( $method, $endpoint, $args = [], $options = [] ) {
456 $options = wp_parse_args( $options, [
457 'return_type' => static::HTTP_RETURN_TYPE_OBJECT,
458 ] );
459
460 $args = array_replace_recursive( [
461 'headers' => $this->is_connected() ? $this->generate_authentication_headers( $endpoint ) : [],
462 'method' => $method,
463 'timeout' => 10,
464 ], $args );
465
466 $response = $this->http->request_with_fallback(
467 $this->get_generated_urls( $endpoint ),
468 $args
469 );
470
471 if ( is_wp_error( $response ) ) {
472 // PHPCS - the variable $response does not contain a user input value.
473 wp_die( $response, [ 'back_link' => true ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
474 }
475
476 $body = wp_remote_retrieve_body( $response );
477 $response_code = (int) wp_remote_retrieve_response_code( $response );
478
479 if ( ! $response_code ) {
480 return new \WP_Error( 500, 'No Response' );
481 }
482
483 // Server sent a success message without content.
484 if ( 'null' === $body ) {
485 $body = true;
486 }
487
488 $body = json_decode( $body, static::HTTP_RETURN_TYPE_ARRAY === $options['return_type'] );
489
490 if ( false === $body ) {
491 return new \WP_Error( 422, 'Wrong Server Response' );
492 }
493
494 if ( 200 !== $response_code ) {
495 // In case $as_array = true.
496 $body = (object) $body;
497
498 $message = isset( $body->message ) ? $body->message : wp_remote_retrieve_response_message( $response );
499 $code = (int) ( isset( $body->code ) ? $body->code : $response_code );
500
501 if ( 401 === $code ) {
502 $this->delete();
503
504 $should_retry = ! in_array( $this->auth_mode, [ 'xhr', 'cli' ], true );
505
506 if ( $should_retry ) {
507 $this->action_authorize();
508 }
509 }
510
511 return new \WP_Error( $code, $message );
512 }
513
514 return $body;
515 }
516
517 /**
518 * Create a signature for the http request
519 *
520 * @param array $payload
521 *
522 * @return false|string
523 */
524 private function generate_signature( $payload = [] ) {
525 return hash_hmac(
526 'sha256',
527 wp_json_encode( $payload, JSON_NUMERIC_CHECK ),
528 $this->get( 'access_token_secret' )
529 );
530 }
531
532 /**
533 * @since 2.3.0
534 * @access protected
535 */
536 protected function get_api_url() {
537 return static::API_URL . '/' . $this->get_slug();
538 }
539 /**
540 * @since 2.3.0
541 * @access protected
542 */
543 protected function get_remote_site_url() {
544 return static::SITE_URL . '/' . $this->get_slug();
545 }
546
547 /**
548 * @since 2.3.0
549 * @access protected
550 */
551 protected function get_remote_authorize_url() {
552 $redirect_uri = $this->get_auth_redirect_uri();
553
554 $allowed_query_params_to_propagate = [
555 'utm_source',
556 'utm_medium',
557 'utm_campaign',
558 'utm_term',
559 'utm_content',
560 'source',
561 'screen_hint',
562 ];
563
564 $query_params = ( new Collection( $_GET ) ) // phpcs:ignore
565 ->only( $allowed_query_params_to_propagate )
566 ->merge( [
567 'action' => 'authorize',
568 'response_type' => 'code',
569 'client_id' => $this->get( 'client_id' ),
570 'auth_secret' => $this->get( 'auth_secret' ),
571 'state' => $this->get( 'state' ),
572 'redirect_uri' => rawurlencode( $redirect_uri ),
573 'may_share_data' => current_user_can( 'manage_options' ) && ! Tracker::is_allow_track(),
574 'reconnect_nonce' => wp_create_nonce( $this->get_slug() . 'reconnect' ),
575 ] );
576
577 return add_query_arg( $query_params->all(), $this->get_remote_site_url() );
578 }
579
580 /**
581 * @since 2.3.0
582 * @access protected
583 */
584 protected function redirect_to_admin_page( $url = '' ) {
585 if ( ! $url ) {
586 $url = Admin::$url;
587 }
588
589 switch ( $this->auth_mode ) {
590 case 'popup':
591 $this->print_popup_close_script( $url );
592 break;
593
594 case 'cli':
595 $this->admin_notice();
596 die;
597
598 default:
599 wp_safe_redirect( $url );
600 die;
601 }
602 }
603
604 /**
605 * @since 2.3.0
606 * @access protected
607 */
608 protected function set_client_id() {
609 $source = Utils::get_super_global_value( $_REQUEST, 'source' ) ?? ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here.
610 $response = $this->request(
611 'get_client_id',
612 [
613 'source' => esc_attr( $source ),
614 ]
615 );
616
617 if ( is_wp_error( $response ) ) {
618 // PHPCS - the variable $response does not contain a user input value.
619 wp_die( $response, $response->get_error_message() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
620 }
621
622 $this->set( 'client_id', $response->client_id );
623 $this->set( 'auth_secret', $response->auth_secret );
624 }
625
626 /**
627 * @since 2.3.0
628 * @access protected
629 */
630 protected function set_request_state() {
631 $this->set( 'state', wp_generate_password( 12, false ) );
632 }
633
634 protected function get_popup_success_event_data() {
635 return [];
636 }
637
638 /**
639 * @since 2.3.0
640 * @access protected
641 */
642 protected function print_popup_close_script( $url ) {
643 $data = $this->get_popup_success_event_data();
644
645 ?>
646 <script>
647 if ( opener && opener !== window ) {
648 opener.jQuery( 'body' ).trigger(
649 'elementor/connect/success/<?php echo esc_attr( Utils::get_super_global_value( $_REQUEST, 'callback_id' ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here. ?>',
650 <?php echo wp_json_encode( $data ); ?>
651 );
652
653 window.close();
654 opener.focus();
655 } else {
656 location = '<?php echo esc_url( $url ); ?>';
657 }
658 </script>
659 <?php
660 die;
661 }
662
663 /**
664 * @since 2.3.0
665 * @access protected
666 */
667 protected function disconnect() {
668 if ( $this->is_connected() ) {
669 // Try update the server, but not needed to handle errors.
670 $this->request( 'disconnect' );
671 }
672
673 $this->delete();
674 }
675
676 /**
677 * @since 2.3.0
678 * @access protected
679 */
680 public function get_site_key() {
681 $site_key = get_option( static::OPTION_CONNECT_SITE_KEY );
682
683 if ( ! $site_key ) {
684 $site_key = md5( uniqid( wp_generate_password() ) );
685 update_option( static::OPTION_CONNECT_SITE_KEY, $site_key );
686 }
687
688 return $site_key;
689 }
690
691 protected function redirect_to_remote_authorize_url() {
692 switch ( $this->auth_mode ) {
693 case 'cli':
694 $this->get_app_token_from_cli_token( Utils::get_super_global_value( $_REQUEST, 'token' ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here.
695 return;
696 default:
697 wp_redirect( $this->get_remote_authorize_url() ); //phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- Safe redirect is used here.
698 die;
699 }
700 }
701
702 protected function get_auth_redirect_uri() {
703 $redirect_uri = $this->get_admin_url( 'get_token' );
704
705 switch ( $this->auth_mode ) {
706 case 'popup':
707 $redirect_uri = add_query_arg( [
708 'mode' => 'popup',
709 'callback_id' => esc_attr( Utils::get_super_global_value( $_REQUEST, 'callback_id' ) ), //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here.
710 ], $redirect_uri );
711 break;
712 }
713
714 return $redirect_uri;
715 }
716
717
718 protected function print_notices( $notices ) {
719 switch ( $this->auth_mode ) {
720 case 'cli':
721 foreach ( $notices as $notice ) {
722 printf( '[%s] %s', wp_kses_post( $notice['type'] ), wp_kses_post( $notice['content'] ) );
723 }
724 break;
725 default:
726 /**
727 * @var Admin_Notices $admin_notices
728 */
729 $admin_notices = Plugin::$instance->admin->get_component( 'admin-notices' );
730
731 foreach ( $notices as $notice ) {
732 $options = [
733 'description' => wp_kses_post( wpautop( $notice['content'] ) ),
734 'type' => $notice['type'],
735 'icon' => false,
736 ];
737
738 $admin_notices->print_admin_notice( $options );
739 }
740 }
741 }
742
743 protected function get_app_info() {
744 return [];
745 }
746
747 protected function print_app_info() {
748 $app_info = $this->get_app_info();
749
750 foreach ( $app_info as $key => $item ) {
751 if ( $item['value'] ) {
752 $status = 'Exist';
753 $color = 'green';
754 } else {
755 $status = 'Empty';
756 $color = 'red';
757 }
758
759 // PHPCS - the values of $item['label'], $color, $status are plain strings.
760 printf( '%s: <strong style="color:%s">%s</strong><br>', $item['label'], $color, $status ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
761 }
762
763 }
764
765 private function get_generated_urls( $endpoint ) {
766 $base_urls = $this->get_api_url();
767
768 if ( ! is_array( $base_urls ) ) {
769 $base_urls = [ $base_urls ];
770 }
771
772 return array_map( function ( $base_url ) use ( $endpoint ) {
773 return trailingslashit( $base_url ) . $endpoint;
774 }, $base_urls );
775 }
776
777 private function init_auth_mode() {
778 $is_rest = defined( 'REST_REQUEST' ) && REST_REQUEST;
779 $is_ajax = wp_doing_ajax();
780
781 if ( $is_rest || $is_ajax ) {
782 // Set default to 'xhr' if rest or ajax request.
783 $this->set_auth_mode( 'xhr' );
784 }
785
786 $mode = Utils::get_super_global_value( $_REQUEST, 'mode' ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here.
787
788 if ( $mode ) {
789 $allowed_auth_modes = [
790 'popup',
791 ];
792
793 if ( defined( 'WP_CLI' ) && WP_CLI ) {
794 $allowed_auth_modes[] = 'cli';
795 }
796
797 if ( in_array( $mode, $allowed_auth_modes, true ) ) {
798 $this->set_auth_mode( $mode );
799 }
800 }
801 }
802
803 public function set_auth_mode( $mode ) {
804 $this->auth_mode = $mode;
805 }
806
807 /**
808 * @since 2.3.0
809 * @access public
810 */
811 public function __construct() {
812 add_action( 'admin_notices', [ $this, 'admin_notice' ] );
813
814 $this->init_auth_mode();
815
816 $this->http = new Http();
817
818 /**
819 * Allow extended apps to customize the __construct without call parent::__construct.
820 */
821 $this->init();
822 }
823 }
824