Skip to content

Commit 8334e7b

Browse files
Merge pull request #1036 from Codeinwp/bugfix/pro/396
Fixed compatibility issue with WP VIP
2 parents 641df4b + 95bd98e commit 8334e7b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

classes/Visualizer/Module.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ protected function get_user_customization_js() {
523523
require_once( ABSPATH . 'wp-admin/includes/file.php' );
524524
WP_Filesystem();
525525
global $wp_filesystem;
526+
if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
527+
$creds = request_filesystem_credentials( site_url() );
528+
wp_filesystem( $creds );
529+
}
526530

527531
$multisite_arg = '/';
528532
if ( is_multisite() && ! is_main_site() ) {

classes/Visualizer/Module/Chart.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,10 @@ public function save_chart_image( $base64_img, $chart_id, $save_attachment = tru
15871587
require_once ABSPATH . '/wp-admin/includes/file.php';
15881588
\WP_Filesystem();
15891589
global $wp_filesystem;
1590+
if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
1591+
$creds = request_filesystem_credentials( site_url() );
1592+
wp_filesystem( $creds );
1593+
}
15901594
$upload_file = $wp_filesystem->put_contents( $upload_path . $hashed_filename, $decoded );
15911595

15921596
// Insert new chart image.

index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ function visualizer_launch() {
7373
define( 'VISUALIZER_REST_VERSION', 1 );
7474
// if the below is true, then the js/customization.js in the plugin folder will be used instead of the one in the uploads folder (if it exists).
7575
// this is also used in Block.php
76-
define( 'VISUALIZER_TEST_JS_CUSTOMIZATION', false );
76+
if ( ! defined( 'VISUALIZER_TEST_JS_CUSTOMIZATION' ) ) {
77+
define( 'VISUALIZER_TEST_JS_CUSTOMIZATION', false );
78+
}
7779

7880
if ( ! defined( 'VISUALIZER_CSV_DELIMITER' ) ) {
7981
define( 'VISUALIZER_CSV_DELIMITER', ',' );

0 commit comments

Comments
 (0)