Skip to content

Commit 031794e

Browse files
release: fixes
- Fixed PHP error when Polylang plugin is activated #960
2 parents 9607e8c + b70478d commit 031794e

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ function setScreenOptions( $status, $option, $value ) {
768768
*/
769769
private function getDisplayFilters( &$query_args ) {
770770
$query = array();
771-
772-
if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
771+
global $sitepress;
772+
if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
773773
$current_lang = icl_get_current_language();
774774
if ( in_array( $current_lang, array( 'all', icl_get_default_language() ), true ) ) {
775775
$query[] = array(
@@ -1138,16 +1138,15 @@ public static function proFeaturesLocked() {
11381138
* @return bool Default false
11391139
*/
11401140
public function addMultilingualSupport( $chart_id ) {
1141+
global $sitepress;
11411142
if ( Visualizer_Module::is_pro() ) {
11421143
return;
11431144
}
1144-
if ( function_exists( 'icl_get_languages' ) ) {
1145+
if ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) {
11451146
$language = icl_get_languages();
11461147
$current_lang = icl_get_current_language();
11471148
$default_lang = icl_get_default_language();
11481149
$post_info = wpml_get_language_information( null, $chart_id );
1149-
1150-
global $sitepress;
11511150
$translations = array();
11521151
if ( ! empty( $post_info ) && ( $default_lang === $post_info['language_code'] ) ) {
11531152
$trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );

classes/Visualizer/Module/Chart.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ public function deleteChart() {
461461
}
462462
}
463463
if ( $success ) {
464-
if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
465-
global $sitepress;
464+
global $sitepress;
465+
if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
466466
$trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
467467
$translations = $sitepress->get_element_translations( $trid );
468468
if ( ! empty( $translations ) ) {

classes/Visualizer/Module/Frontend.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ public function renderChart( $atts ) {
305305
$atts
306306
);
307307

308-
if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
308+
global $sitepress;
309+
if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
309310
global $sitepress;
310311
$locale = icl_get_current_language();
311312
$locale = strtolower( str_replace( '_', '-', $locale ) );

cypress/integration/gutenberg-datatable/free-gutenberg-datatable.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('Test Free - gutenberg (datatable)', function() {
1818
it('Verify insertion of charts', function() {
1919
cy.visit('/wp-admin/post-new.php');
2020

21-
cy.clear_welcome();
21+
// get rid of that irritating popup
22+
cy.get('.edit-post-welcome-guide .components-modal__header button').click();
2223

2324
var charts = Array.from({ length: 1 }, function(_item, index) {
2425
return index + 1;

cypress/integration/gutenberg/free-gutenberg.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('Test Free - gutenberg', function() {
1818
it('Verify insertion of charts', function() {
1919
cy.visit('/wp-admin/post-new.php');
2020

21-
cy.clear_welcome();
21+
// get rid of that irritating popup
22+
cy.get('.edit-post-welcome-guide .components-modal__header button').click();
2223

2324
var charts = Array.from({ length: parseInt(Cypress.env('chart_types').free - 1) }, function(_item, index) {
2425
return index + 1;

0 commit comments

Comments
 (0)