Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,8 @@ function setScreenOptions( $status, $option, $value ) {
*/
private function getDisplayFilters( &$query_args ) {
$query = array();

if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
global $sitepress;
if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
$current_lang = icl_get_current_language();
if ( in_array( $current_lang, array( 'all', icl_get_default_language() ), true ) ) {
$query[] = array(
Expand Down Expand Up @@ -1138,16 +1138,15 @@ public static function proFeaturesLocked() {
* @return bool Default false
*/
public function addMultilingualSupport( $chart_id ) {
global $sitepress;
if ( Visualizer_Module::is_pro() ) {
return;
}
if ( function_exists( 'icl_get_languages' ) ) {
if ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) {
$language = icl_get_languages();
$current_lang = icl_get_current_language();
$default_lang = icl_get_default_language();
$post_info = wpml_get_language_information( null, $chart_id );

global $sitepress;
$translations = array();
if ( ! empty( $post_info ) && ( $default_lang === $post_info['language_code'] ) ) {
$trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
Expand Down
4 changes: 2 additions & 2 deletions classes/Visualizer/Module/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ public function deleteChart() {
}
}
if ( $success ) {
if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
global $sitepress;
global $sitepress;
if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
$trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
$translations = $sitepress->get_element_translations( $trid );
if ( ! empty( $translations ) ) {
Expand Down
3 changes: 2 additions & 1 deletion classes/Visualizer/Module/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ public function renderChart( $atts ) {
$atts
);

if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
global $sitepress;
if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
global $sitepress;
$locale = icl_get_current_language();
$locale = strtolower( str_replace( '_', '-', $locale ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ describe('Test Free - gutenberg (datatable)', function() {
it('Verify insertion of charts', function() {
cy.visit('/wp-admin/post-new.php');

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

var charts = Array.from({ length: 1 }, function(_item, index) {
return index + 1;
Expand Down
3 changes: 2 additions & 1 deletion cypress/integration/gutenberg/free-gutenberg.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ describe('Test Free - gutenberg', function() {
it('Verify insertion of charts', function() {
cy.visit('/wp-admin/post-new.php');

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

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