PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.85
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.85
5.5.85 5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 All 161 releases
← All changes | WPDataAccess/Data_Apps/WPDA_Container.php +38 -25 5.5.37 → 5.5.85 View file →
@@ -8,8 +8,10 @@
8 8 private $feedback = false;
9 9
10 10 private $fullscreen = false;
11 11
12 + protected $pwa = false;
13 +
12 14 private $hideTitleBar = false;
13 15
14 16 protected $builders = true;
15 17
@@ -25,8 +27,11 @@
25 27 }
26 28 if ( isset( $args['fullscreen'] ) ) {
27 29 $this->fullscreen = true === $args['fullscreen'] || 'true' === $args['fullscreen'];
28 30 }
31 + if ( isset( $args['pwa'] ) ) {
32 + $this->pwa = true === $args['pwa'] || 'true' === $args['pwa'];
33 + }
29 34 if ( isset( $args['hidetitlebar'] ) ) {
30 35 $this->hideTitleBar = true === $args['hidetitlebar'] || 'true' === $args['hidetitlebar'];
31 36 }
32 37 if ( isset( $args['filter_field_name'] ) ) {
@@ -38,12 +43,12 @@
38 43 wp_enqueue_style( 'wpda_apps' );
39 44 wp_enqueue_media();
40 45 }
41 46
42 - protected function add_client( $app_id = null ) {
43 - $mainjs = 'main-' . WPDA::get_option( WPDA::OPTION_WPDA_CLIENT_VERSION ) . '.js';
47 + protected function add_client( $entry_point, $app_id = null ) {
48 + $mainjs = "{$entry_point}-" . WPDA::get_option( WPDA::OPTION_WPDA_CLIENT_VERSION ) . '.js';
44 49 $script_path = plugin_dir_url( __DIR__ ) . "../assets/dist/";
45 - $script_url = "{$script_path}/{$mainjs}";
50 + $script_url = esc_url( "{$script_path}{$mainjs}" );
46 51 $app_site = wpda_freemius()->get_site();
47 52 unset($app_site->public_key);
48 53 unset($app_site->secret_key);
49 54 $app_licenses = wpda_freemius()->get_available_premium_licenses();
@@ -51,74 +56,82 @@
51 56 for ($i = 0; $i < count( $app_licenses ); $i++) {
52 57 unset($app_licenses[$i]->secret_key);
53 58 }
54 59 }
60 + // phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript -- loading module
55 61 ?>
56 62
57 63 <script>
58 - if (! window.PP_APP_CONFIG) {
59 - window.PP_APP_CONFIG = {
60 - appDebug: <?php
64 + if (!window.PP_APP_CONFIG) {
65 + window.PP_APP_CONFIG = {
66 + appDebug: <?php
61 67 echo ( 'on' === WPDA::get_option( WPDA::OPTION_PLUGIN_DEBUG ) ? 'true' : 'false' );
62 68 ?>,
63 - appLocales: "<?php
69 + appLocales: "<?php
64 70 echo esc_url( $script_path ) . 'locales/';
65 71 ?>",
66 - appSite: <?php
72 + appSite: <?php
67 73 echo json_encode( $app_site, true );
68 74 ?>,
69 - appLicenses: <?php
75 + appLicenses: <?php
70 76 echo json_encode( array(
71 77 'license' => $app_licenses,
72 78 'local' => wpda_freemius()->can_use_premium_code__premium_only(),
73 79 ), true );
74 80 ?>,
75 - appTarget: "<?php
81 + appTarget: "<?php
76 82 echo ( is_admin() ? 'backend' : 'frontend' );
77 83 ?>",
78 - appIp: "<?php
79 - echo esc_attr( $_SERVER['REMOTE_ADDR'] );
84 + appIp: "<?php
85 + echo ( isset( $_SERVER['REMOTE_ADDR'] ) ? esc_html( sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) ) : '' );
80 86 ?>",
81 - appUser: "<?php
87 + appUser: "<?php
82 88 echo esc_attr( WPDA::get_current_user_login() );
83 89 ?>",
84 - appRoles: <?php
90 + appRoles: <?php
85 91 echo ( false === $this->builders ? json_encode( array() ) : json_encode( WPDA::get_current_user_roles() ) );
86 92 ?>,
87 - appLogin: <?php
93 + appLogin: <?php
88 94 echo ( 'anonymous' !== WPDA::get_current_user_login() ? 'true' : 'false' );
89 95 ?>,
90 - appVars: <?php
96 + appVars: <?php
97 + // phpcs:disable WordPress.Security.NonceVerification.Missing
91 98 echo json_encode( $_POST, true );
99 + // phpcs:enable WordPress.Security.NonceVerification.Missing
92 100 ?>,
93 - }
94 - }
95 - <?php
101 + }
102 + }
103 + <?php
96 104 if ( null !== $app_id ) {
97 105 // Supporting multiple apps on same page with different settings
98 106 ?>
99 - window.PP_APP_CONFIG[<?php
107 + window.PP_APP_CONFIG[<?php
100 108 echo esc_attr( $app_id );
101 109 ?>] = {
102 - appRoles: <?php
110 + appRoles: <?php
103 111 echo ( false === $this->builders ? json_encode( array() ) : json_encode( WPDA::get_current_user_roles() ) );
104 112 ?>,
105 - appFullscreen: <?php
113 + appFullscreen: <?php
106 114 echo ( $this->fullscreen ? 'true' : 'false' );
107 115 ?>,
108 - hideTitleBar: <?php
116 + appPwa: <?php
117 + echo ( $this->pwa ? 'true' : 'false' );
118 + ?>,
119 + hideTitleBar: <?php
109 120 echo ( $this->hideTitleBar ? 'true' : 'false' );
110 121 ?>,
111 - }
112 - <?php
122 + }
123 + <?php
113 124 }
114 125 ?>
115 126 </script>
127 +
116 128 <script type="module" src="<?php
117 129 echo esc_attr( $script_url );
118 130 ?>"></script>
119 131
120 132 <?php
133 + // phpcs:enable WordPress.WP.EnqueuedResources.NonEnqueuedScript
121 134 }
122 135
123 136 protected function send_feedback() {
124 137 return $this->feedback;