<?php
/**
 * Abort if this file is accessed directly.
 */
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
  
$show_options = get_option( 'course_scheduler_ld_addon_setting' );
$show_courses = ! empty( $show_options ) ? $show_options : 'show' ; 
$license_class = $GLOBALS['lcms_license']->license_class;
if( ! function_exists('get_plugin_data') ){
	require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
$plugin_data = get_plugin_data( LD_CPP_FILE );

?>
<div id="wmca_license_options" class="cs_ld_tabs ARwebcrafts_addon_plnr-crse">
<div class="ldcpp-loader-ovrly-pnl">
	<div class="ldcpp-loader-ovrly"></div>
</div>
    <form method="post">
        <h2><?php _e( 'Receive Automatic Updates', 'cs_ld_addon' ) ?></h2>
        <h4><?php echo sprintf(__( 'Please enter the license key to keep your "LearnDash Course Planner Pro" plugin updated, and receive new features and improvements automatically.', 'cs_ld_addon' ), $plugin_data['Name']) ?></h4>
        <h4><?php echo sprintf(__( "Don't have the license key? Click <a href='%s' target='_blank'>here</a> to get one.", 'cs_ld_addon' ), $plugin_data['PluginURI']); ?></h4>

        <table class="form-table">
            <tr>
                <th style="width:100px;"><label
                            for="<?php echo $license_class->get_license_key_field(); ?>"><?php _e( 'License Key', 'cs_ld_addon' ); ?></label>
                </th>
                <td>
                    <input class="regular-text" type="text" id="<?php echo $license_class->get_license_key_field(); ?>"
                           placeholder="<?php _e( 'Enter license key provided with plugin', 'cs_ld_addon' ) ?>"
                           name="<?php echo $license_class->get_license_key_field(); ?>"
                           value="<?php echo get_option( 'wn_lcms_license_key' ); ?>"
                        <?php echo ( $license_class->get_license_handler()->is_active() ) ? 'readonly' : ''; ?>>
                </td>
            </tr>
        </table>
        <p class="submit">
            <?php if( ! $license_class->get_license_handler()->is_active() ) : ?>
                <input type="submit" name="lcms_activate_license" value="<?php _e( 'Activate', 'cs_ld_addon' ); ?>"
                       class="button-primary" style="float:left;display:block"/>
            <?php endif; ?>

            <?php if( $license_class->get_license_handler()->is_active() ) : ?>
                <input type="submit" name="lcms_deactivate_license" value="<?php _e( 'Deactivate', 'cs_ld_addon' ); ?>"
                       />
            <?php endif; ?>
        </p>
    </form>
</div>