Skip to content

Commit

Permalink
release(minor): fixes
Browse files Browse the repository at this point in the history
- Added a setup wizard onboarding page
- Fixed empty chart issue
  • Loading branch information
vytisbulkevicius authored Apr 4, 2023
2 parents f1b1e20 + 223fcee commit 8150564
Show file tree
Hide file tree
Showing 29 changed files with 2,598 additions and 24 deletions.
3 changes: 3 additions & 0 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ public function handleGetProSubMenu() {
#toplevel_page_visualizer ul.wp-submenu li.wp-first-item + li + li + li > a:hover {
box-shadow: inherit;
}
#toplevel_page_visualizer ul.wp-submenu li.wp-first-item + li + li + li + li {
display: none;
}
</style>
<script type="text/javascript">
jQuery( document ).ready( function() {
Expand Down
2 changes: 2 additions & 0 deletions classes/Visualizer/Module/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
$this->_addAction( 'wp_print_footer_scripts', 'printFooterScripts' );
$this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' );
$this->_addAction( 'load-index.php', 'enqueueScripts' );
$this->_addAction( 'load-visualizer_page_visualizer-setup-wizard', 'enqueueScripts' );
$this->_addAction( 'visualizer_enqueue_scripts', 'enqueueScripts' );
$this->_addFilter( 'visualizer_get_language', 'getLanguage' );
$this->_addShortcode( 'visualizer', 'renderChart' );
Expand Down Expand Up @@ -368,6 +369,7 @@ public function renderChart( $atts ) {

// Get and update settings.
$settings = $chart_data['settings'];
$settings = ! empty( $settings ) ? $settings : array();
if ( empty( $settings['height'] ) ) {
$settings['height'] = '400';
}
Expand Down
23 changes: 21 additions & 2 deletions classes/Visualizer/Module/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ private function activate_on_site() {
wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' );
wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'hourly' ), 'visualizer_schedule_refresh_db' );
add_option( 'visualizer-activated', true );
$is_fresh_install = get_option( 'visualizer_fresh_install', false );
if ( ! defined( 'TI_CYPRESS_TESTING' ) && false === $is_fresh_install ) {
update_option( 'visualizer_fresh_install', '1' );
}
}

/**
Expand Down Expand Up @@ -251,8 +255,23 @@ public function adminInit() {
if ( get_option( 'visualizer-activated' ) ) {
delete_option( 'visualizer-activated' );
if ( ! headers_sent() ) {
$page_name = Visualizer_Module::numberOfCharts() > 0 ? Visualizer_Plugin::NAME : 'viz-support';
wp_redirect( esc_url_raw( add_query_arg( 'page', $page_name, admin_url( 'admin.php' ) ) ) );
if ( ! Visualizer_Module::is_pro() && ! empty( get_option( 'visualizer_fresh_install', false ) ) ) {
$redirect_url = array(
'page' => 'visualizer-setup-wizard',
'tab' => '#step-1',
);
} else {
$page_name = Visualizer_Module::numberOfCharts() > 0 ? Visualizer_Plugin::NAME : 'viz-support';
$redirect_url = array(
'page' => $page_name,
);
}
wp_safe_redirect(
add_query_arg(
$redirect_url,
admin_url( 'admin.php' )
)
);
exit();
}
}
Expand Down
Loading

0 comments on commit 8150564

Please sign in to comment.