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 -27 5.5.36 → 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,27 +27,28 @@
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'] ) ) {
33 38 $this->filter_field_name = WPDA_API_Core::sanitize_db_identifier( $args['filter_field_name'] );
34 - $this->shortcode_args['filter_field_name'] = $this->filter_field_name;
35 39 }
36 40 if ( isset( $args['filter_field_value'] ) ) {
37 41 $this->filter_field_value = sanitize_text_field( $args['filter_field_value'] );
38 - $this->shortcode_args['filter_field_value'] = $this->filter_field_value;
39 42 }
40 43 wp_enqueue_style( 'wpda_apps' );
41 44 wp_enqueue_media();
42 45 }
43 46
44 - protected function add_client( $app_id = null ) {
45 - $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';
46 49 $script_path = plugin_dir_url( __DIR__ ) . "../assets/dist/";
47 - $script_url = "{$script_path}/{$mainjs}";
50 + $script_url = esc_url( "{$script_path}{$mainjs}" );
48 51 $app_site = wpda_freemius()->get_site();
49 52 unset($app_site->public_key);
50 53 unset($app_site->secret_key);
51 54 $app_licenses = wpda_freemius()->get_available_premium_licenses();
@@ -53,74 +56,82 @@
53 56 for ($i = 0; $i < count( $app_licenses ); $i++) {
54 57 unset($app_licenses[$i]->secret_key);
55 58 }
56 59 }
60 + // phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript -- loading module
57 61 ?>
58 62
59 63 <script>
60 - if (! window.PP_APP_CONFIG) {
61 - window.PP_APP_CONFIG = {
62 - appDebug: <?php
64 + if (!window.PP_APP_CONFIG) {
65 + window.PP_APP_CONFIG = {
66 + appDebug: <?php
63 67 echo ( 'on' === WPDA::get_option( WPDA::OPTION_PLUGIN_DEBUG ) ? 'true' : 'false' );
64 68 ?>,
65 - appLocales: "<?php
69 + appLocales: "<?php
66 70 echo esc_url( $script_path ) . 'locales/';
67 71 ?>",
68 - appSite: <?php
72 + appSite: <?php
69 73 echo json_encode( $app_site, true );
70 74 ?>,
71 - appLicenses: <?php
75 + appLicenses: <?php
72 76 echo json_encode( array(
73 77 'license' => $app_licenses,
74 78 'local' => wpda_freemius()->can_use_premium_code__premium_only(),
75 79 ), true );
76 80 ?>,
77 - appTarget: "<?php
81 + appTarget: "<?php
78 82 echo ( is_admin() ? 'backend' : 'frontend' );
79 83 ?>",
80 - appIp: "<?php
81 - 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'] ) ) ) : '' );
82 86 ?>",
83 - appUser: "<?php
87 + appUser: "<?php
84 88 echo esc_attr( WPDA::get_current_user_login() );
85 89 ?>",
86 - appRoles: <?php
90 + appRoles: <?php
87 91 echo ( false === $this->builders ? json_encode( array() ) : json_encode( WPDA::get_current_user_roles() ) );
88 92 ?>,
89 - appLogin: <?php
93 + appLogin: <?php
90 94 echo ( 'anonymous' !== WPDA::get_current_user_login() ? 'true' : 'false' );
91 95 ?>,
92 - appVars: <?php
96 + appVars: <?php
97 + // phpcs:disable WordPress.Security.NonceVerification.Missing
93 98 echo json_encode( $_POST, true );
99 + // phpcs:enable WordPress.Security.NonceVerification.Missing
94 100 ?>,
95 - }
96 - }
97 - <?php
101 + }
102 + }
103 + <?php
98 104 if ( null !== $app_id ) {
99 105 // Supporting multiple apps on same page with different settings
100 106 ?>
101 - window.PP_APP_CONFIG[<?php
107 + window.PP_APP_CONFIG[<?php
102 108 echo esc_attr( $app_id );
103 109 ?>] = {
104 - appRoles: <?php
110 + appRoles: <?php
105 111 echo ( false === $this->builders ? json_encode( array() ) : json_encode( WPDA::get_current_user_roles() ) );
106 112 ?>,
107 - appFullscreen: <?php
113 + appFullscreen: <?php
108 114 echo ( $this->fullscreen ? 'true' : 'false' );
109 115 ?>,
110 - hideTitleBar: <?php
116 + appPwa: <?php
117 + echo ( $this->pwa ? 'true' : 'false' );
118 + ?>,
119 + hideTitleBar: <?php
111 120 echo ( $this->hideTitleBar ? 'true' : 'false' );
112 121 ?>,
113 - }
114 - <?php
122 + }
123 + <?php
115 124 }
116 125 ?>
117 126 </script>
127 +
118 128 <script type="module" src="<?php
119 129 echo esc_attr( $script_url );
120 130 ?>"></script>
121 131
122 132 <?php
133 + // phpcs:enable WordPress.WP.EnqueuedResources.NonEnqueuedScript
123 134 }
124 135
125 136 protected function send_feedback() {
126 137 return $this->feedback;