<?php
/**
 * Getting Started Help Notic
 **/
function music_blog_general_admin_notice(){
?>
<div data-dismissible="disable-done-notice-forever" class="notice notice-info music-blog-welcome-notice">
    <div class="music-blog-notice-wrapper">
        <div class="music-blog-notice-inner">
            <div class="notice-thumbnail-col">
              <img src="<?php echo esc_url(get_theme_file_uri('screenshot.png'));?>" alt="<?php esc_attr_e('Food Blogger Pro', 'music-blog');?>">
            </div>
            <div class="notice-content-col">
              <h3>
               <?php esc_html_e('Thank you for installing the Food Blogger WordPress Theme.', 'music-blog'); ?>
              </h3>
              <p class="notice-desc">
              <?php esc_html_e('Ready to create a stunning Blog website? Click the Install Starter Website Templates button, and you\'ll be redirected to our demo page to get started.', 'music-blog'); ?>
              </p>
              <p>
              <a class="music-blog-btn-get-started button button-primary music-blog-button-padding" href="#" data-name="" data-slug="">
              <?php esc_html_e( 'Install Starter Website Templates', 'music-blog' );?></a>
              <a target="_blank" href="<?php echo esc_url('https://rswpthemes.com/shofy/demo');?>" class="button button-highlight btn-doc button-primary" style="color:#fff;">
              <?php esc_html_e( ' View Demo', 'music-blog' );?></a>
              <a target="_blank" href="<?php echo esc_url(music_blog_utm_url('welcome_notice'));?>" class="button button-highlight upgrade-to-pro button-primary"><?php esc_html_e( 'Upgrade To Pro', 'music-blog' );?></a>
              <a href="?music_blog_notice_dismissed" style="text-decoration: none; float: right;">
              <?php esc_html_e( 'Dismiss Notice', 'music-blog' );?></a>
              </p>
            </div>
        </div>
    </div>
</div>
<?php
}

if ( isset( $_GET['music_blog_notice_dismissed'] ) ){
   update_option('music_blog_help_notice', 'notice_music_blog_dismissed');
   set_transient('music_blog_wn_dismissed_time', time(), 24 * 60 * 60);
}

add_action('admin_init', function(){
    $music_blog_help_notice = get_option('music_blog_help_notice', '');
    if('music_blog_notice_dismissed' === $music_blog_help_notice) {
        $dismissed_time = get_transient('music_blog_wn_dismissed_time');
        if (false === $dismissed_time && time() > $dismissed_time + ( 24 * 60 * 60 )) {
            delete_option('music_blog_notice_dismissed');
            delete_transient('music_blog_wn_dismissed_time');
            add_action('admin_notices', 'music_blog_general_admin_notice');
        }
    }
});

$music_blog_help_notice = get_option('music_blog_help_notice', '');
if (($music_blog_help_notice != 'notice_music_blog_dismissed' || $music_blog_help_notice === '') ){
   add_action('admin_notices', 'music_blog_general_admin_notice');
}