@@ -534,7 +534,7 @@ public function renderChartPages() {
534
534
wp_register_style ( 'visualizer-chosen ' , VISUALIZER_ABSURL . 'css/lib/chosen.min.css ' , array (), Visualizer_Plugin::VERSION );
535
535
536
536
wp_register_style ( 'visualizer-frame ' , VISUALIZER_ABSURL . 'css/frame.css ' , array ( 'visualizer-chosen ' ), Visualizer_Plugin::VERSION );
537
- wp_register_script ( 'visualizer-frame ' , VISUALIZER_ABSURL . 'js/frame.js ' , array ( 'visualizer-chosen ' , 'jquery-ui-accordion ' ), Visualizer_Plugin::VERSION , true );
537
+ wp_register_script ( 'visualizer-frame ' , VISUALIZER_ABSURL . 'js/frame.js ' , array ( 'visualizer-chosen ' , 'jquery-ui-accordion ' , ' jquery-ui-tabs ' ), Visualizer_Plugin::VERSION , true );
538
538
wp_register_script ( 'visualizer-customization ' , $ this ->get_user_customization_js (), array (), null , true );
539
539
wp_register_script (
540
540
'visualizer-render ' ,
@@ -575,6 +575,7 @@ public function renderChartPages() {
575
575
// if the cancel button is clicked.
576
576
$ this ->undoRevisions ( $ chart_id , true );
577
577
} elseif ( isset ( $ _POST ['save ' ] ) && 1 === intval ( $ _POST ['save ' ] ) ) {
578
+ $ this ->handlePermissions ();
578
579
// if the save button is clicked.
579
580
$ this ->undoRevisions ( $ chart_id , false );
580
581
} else {
@@ -591,7 +592,7 @@ public function renderChartPages() {
591
592
$ this ->_handleTypesPage ();
592
593
break ;
593
594
default :
594
- do_action ( ' visualizer_pro_handle_tab ' , $ tab , $ this -> _chart );
595
+ // this should never happen.
595
596
break ;
596
597
}
597
598
defined ( 'WP_TESTS_DOMAIN ' ) ? wp_die () : exit ();
@@ -652,13 +653,31 @@ private function loadCodeEditorAssets( $chart_id ) {
652
653
return $ table_col_mapping ;
653
654
}
654
655
656
+ /**
657
+ * Handle permissions from the new conslidated settings sidebar.
658
+ */
659
+ private function handlePermissions () {
660
+ if ( ! Visualizer_Module::is_pro () ) {
661
+ return ;
662
+ }
663
+
664
+ // we will not support old free and new pro.
665
+ // handling new free and old pro.
666
+ if ( has_action ( 'visualizer_pro_handle_tab ' ) ) {
667
+ do_action ( 'visualizer_pro_handle_tab ' , 'permissions ' , $ this ->_chart );
668
+ } else {
669
+ do_action ( 'visualizer_handle_permissions ' , $ this ->_chart );
670
+ }
671
+ }
672
+
655
673
/**
656
674
* Handle data and settings page
657
675
*/
658
676
private function _handleDataAndSettingsPage () {
659
677
if ( isset ( $ _POST ['map_api_key ' ] ) ) {
660
678
update_option ( 'visualizer-map-api-key ' , $ _POST ['map_api_key ' ] );
661
679
}
680
+
662
681
if ( $ _SERVER ['REQUEST_METHOD ' ] === 'POST ' && isset ( $ _GET ['nonce ' ] ) && wp_verify_nonce ( $ _GET ['nonce ' ] ) ) {
663
682
if ( $ this ->_chart ->post_status === 'auto-draft ' ) {
664
683
$ this ->_chart ->post_status = 'publish ' ;
@@ -691,7 +710,6 @@ private function _handleDataAndSettingsPage() {
691
710
$ render = new Visualizer_Render_Page_Send ();
692
711
$ render ->text = sprintf ( '[visualizer id="%d"] ' , $ this ->_chart ->ID );
693
712
wp_iframe ( array ( $ render , 'render ' ) );
694
-
695
713
return ;
696
714
}
697
715
$ data = $ this ->_getChartArray ();
@@ -743,6 +761,7 @@ private function _handleDataAndSettingsPage() {
743
761
'loading ' => esc_html__ ( 'Loading... ' , 'visualizer ' ),
744
762
'json_error ' => esc_html__ ( 'An error occured in fetching data. ' , 'visualizer ' ),
745
763
'select_columns ' => esc_html__ ( 'Please select a few columns to include in the chart. ' , 'visualizer ' ),
764
+ 'save_settings ' => esc_html__ ( 'The settings seem to have changed. If you want to update your data, please save the chart first to save your settings. If you continue, you may lose your changes. ' , 'visualizer ' ),
746
765
),
747
766
'charts ' => array (
748
767
'canvas ' => $ data ,
0 commit comments