Пример #1
0
<?php

/**
 * Admin View: Notice - Update
 */
if (!defined('ABSPATH')) {
    exit;
}
if (!WC_CRM_Admin_Notices::has_notice('crm_install')) {
    ?>
<div id="message" class="updated">
	<p><?php 
    _e('<strong>WooCommerce CRM Data Update Required</strong> &#8211; We just need to update your install to the latest version', 'wc_crm');
    ?>
</p>
	<p class="submit"><a href="<?php 
    echo esc_url(add_query_arg('do_update_wc_crm', 'true', admin_url('admin.php?page=' . WC_CRM_TOKEN . '-settings')));
    ?>
" class="wc-update-now button-primary"><?php 
    _e('Run the updater', 'woocommerce');
    ?>
</a></p>
</div>
<script type="text/javascript">
	jQuery( '.wc-update-now' ).click( 'click', function() {
		return window.confirm( '<?php 
    echo esc_js(__('It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'woocommerce'));
    ?>
' );
	});
</script>
Пример #2
0
 /**
  * Handle redirects to setup/welcome page after install and updates.
  *
  * Transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
  */
 public function admin_redirects()
 {
     if (!get_transient('_wc_crm_activation_redirect') || is_network_admin() || isset($_GET['activate-multi']) || !current_user_can('manage_woocommerce')) {
         return;
     }
     delete_transient('_wc_crm_activation_redirect');
     if (!empty($_GET['page']) && in_array($_GET['page'], array(WC_CRM_TOKEN . '-setup', WC_CRM_TOKEN . '-about'))) {
         return;
     }
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     // If the user needs to install, send them to the setup wizard
     if (WC_CRM_Admin_Notices::has_notice('crm_install')) {
         wp_safe_redirect(admin_url('index.php?page=' . WC_CRM_TOKEN . '-setup'));
         exit;
         // Otherwise, the welcome page
     } else {
         wp_safe_redirect(admin_url('index.php?page=' . WC_CRM_TOKEN . '-about'));
         exit;
     }
 }