}
$color = edd_get_option('checkout_color', 'gray');
$color = $color == 'inherit' ? '' : $color;
?>
<p><a href="<?php 
echo esc_url(remove_query_arg(array('view', 'license_id', 'edd_sl_error', '_wpnonce')));
?>
" class="edd-manage-license-back edd-submit button <?php 
echo esc_attr($color);
?>
"><?php 
_e('Go back', 'edd_sl');
?>
</a></p>
<?php 
edd_sl_show_errors();
?>
<table id="edd_sl_license_upgrades" class="edd_sl_table">
	<thead>
		<tr class="edd_sl_license_row">
			<?php 
do_action('edd_sl_license_upgrades_header_before');
?>
			<th class="edd_sl_url"><?php 
echo edd_get_label_singular();
?>
</th>
			<th class="edd_sl_actions"><?php 
_e('Upgrade Cost', 'edd_sl');
?>
</th>
Example #2
0
/**
 * Renders the main Licenses admin page
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_sl_licenses_page()
{
    ?>
	<div class="wrap">

		<div id="icon-edit" class="icon32"><br/></div>
		<h2><?php 
    _e('Easy Digital Download Licenses', 'edd_sl');
    ?>
</h2>
		<?php 
    edd_sl_show_errors();
    ?>
		<?php 
    if (!empty($_GET['action']) && 'manage_sites' == $_GET['action']) {
        ?>
			<?php 
        $license_id = absint($_GET['license_id']);
        ?>
			<div id="poststuff">
				<div id="post-body" class="metabox-holder columns-1">
					<div id="postbox-container-1" class="postbox-container">
						<div class="postbox">
							<h3 class="hndle">
								<span><?php 
        printf(__('Active Sites for %s', 'edd_sl'), edd_software_licensing()->get_license_key($license_id));
        ?>
</span>
							</h3>
							<table class="wp-list-table widefat fixed">
							<?php 
        $sites = edd_software_licensing()->get_sites($license_id);
        if (!empty($sites)) {
            $i = 0;
            foreach ($sites as $site) {
                ?>
								<?php 
                $site_url = strpos($site, 'http') !== false ? $site : 'http://' . $site;
                ?>
								<tr class="row<?php 
                if ($i % 2 == 0) {
                    echo ' alternate';
                }
                ?>
">
									<td><a href="<?php 
                echo $site_url;
                ?>
" target="_blank"><?php 
                echo $site;
                ?>
</a></td>
									<td><a href="<?php 
                echo wp_nonce_url(add_query_arg(array('edd_action' => 'deactivate_site', 'site_url' => $site)), 'edd_deactivate_site_nonce');
                ?>
"><?php 
                _e('Deactivate Site', 'edd_sl');
                ?>
</a></td>
								</tr>
								<?php 
                $i++;
            }
        } else {
            ?>
							<tr class="row"><td colspan="2"><?php 
            _e('This license has not been activated on any sites', 'edd_sl');
            ?>
</td></tr>
							<?php 
        }
        ?>
							</table>
							<form method="post">
								<div class="inside">
									<p><?php 
        _e('Use this form to add a new site URL for this license. Once added, the site will be considered active and will be included in the total site count.', 'edd_sl');
        ?>
</p>
									<p>
										<input type="text" name="site_url"  value="http://"/>
										<span class="description"><?php 
        _e('Enter the site URL including http://', 'edd_sl');
        ?>
</span>
									</p>
									<p>
										<?php 
        wp_nonce_field('edd_add_site_nonce', 'edd_add_site_nonce');
        ?>
										<input type="hidden" name="edd_action" value="insert_site"/>
										<input type="hidden" name="license_id" value="<?php 
        echo esc_attr($license_id);
        ?>
"/>
										<input type="submit" class="button-primary button" value="<?php 
        _e('Add Site', 'edd_sl');
        ?>
"/>
									</p>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>

		<?php 
    } elseif (!empty($_GET['action']) && 'edit_exp' == $_GET['action']) {
        ?>

			<?php 
        $license_id = absint($_GET['license_id']);
        $is_lifetime = edd_software_licensing()->is_lifetime_license($license_id);
        $expiration = '';
        if (!$is_lifetime) {
            $expiration = edd_software_licensing()->get_license_expiration($license_id);
            $expiration = date('m/d/Y', $expiration);
        }
        $child_args = array('post_type' => 'edd_license', 'post_status' => array('publish', 'future'), 'posts_per_page' => -1, 'post_parent' => $license_id);
        $has_children = get_posts($child_args);
        ?>
			<div id="poststuff">
				<div id="post-body" class="metabox-holder columns-1">
					<div id="postbox-container-1" class="postbox-container">
						<div class="postbox">
							<h3 class="hndle">
								<span><?php 
        printf(__('Edit Expiration for %s', 'edd_sl'), edd_software_licensing()->get_license_key($license_id));
        ?>
</span>
							</h3>
							<form method="post">
								<div class="inside">
									<p>
										<input id="edit_expiration_date" <?php 
        echo $is_lifetime ? 'disabled="disabled"' : '';
        ?>
 type="text" name="expiration" class="edd_datepicker" value="<?php 
        echo esc_attr($expiration);
        ?>
"/>
										<span class="description"><?php 
        _e('Choose a new expiration date.', 'edd_sl');
        ?>
</span>
									</p>
									<p>
										<input id="edit_expiration_is_lifetime" type="checkbox" name="lifetime" value="1" <?php 
        checked(true, $is_lifetime, true);
        ?>
 />
										<label for="edit_expiration_is_lifetime"><?php 
        _e('Lifetime License', 'edd_sl');
        ?>
</label>
									</p>
									<?php 
        if (!empty($has_children)) {
            ?>
									<p>
										<span class="edd-notice">
											<?php 
            _e('This license key is associated with the purchase of a bundled product. Changing its expiration date will alter the expiration of all associated license keys.', 'edd_sl');
            ?>
										</span>
									</p>
									<?php 
        }
        ?>
									<p>
										<?php 
        wp_nonce_field('edd_edit_exp_nonce', 'edd_edit_exp_nonce');
        ?>
										<input type="hidden" name="edd_action" value="update_license_expiration"/>
										<input type="hidden" name="license_id" value="<?php 
        echo esc_attr($license_id);
        ?>
"/>
										<input type="submit" class="button-primary button" value="<?php 
        _e('Update Expiration', 'edd_sl');
        ?>
"/>
									</p>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>

		<?php 
    } else {
        ?>
			<style>
				.column-status, .column-count { width: 100px; }
				.column-limit { width: 150px; }
			</style>
			<form id="licenses-filter" method="get">

				<input type="hidden" name="post_type" value="download" />
				<input type="hidden" name="page" value="edd-licenses" />
				<?php 
        $licenses_table = new EDD_SL_List_Table();
        $licenses_table->prepare_items();
        $licenses_table->search_box('search', 'edd_sl_search');
        $licenses_table->views();
        $licenses_table->display();
        ?>
			</form>

		<?php 
    }
    ?>

	</div>
	<?php 
    $redirect = get_transient('_edd_sl_bulk_actions_redirect');
    if (false !== $redirect) {
        delete_transient('_edd_sl_bulk_actions_redirect');
        ?>
	<script type="text/javascript">
	window.location = "<?php 
        echo admin_url('edit.php?post_type=download&page=edd-licenses');
        ?>
";
	</script>
	<?php 
    }
}