| 1 |
<?php |
| 2 |
|
| 3 |
defined('ABSPATH') or die('Jog on!'); |
| 4 |
|
| 5 |
function sh_cd_advertise_pro() { |
| 6 |
|
| 7 |
$site_hash = sh_cd_generate_site_hash(); |
| 8 |
|
| 9 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 10 |
wp_die( __( 'You do not have sufficient permissions to access this page.', SH_CD_SLUG ) ); |
| 11 |
} |
| 12 |
|
| 13 |
// Remove existing license? |
| 14 |
if ( false === empty( $_GET['remove-license'] ) ) { |
| 15 |
sh_cd_license_remove(); |
| 16 |
} |
| 17 |
|
| 18 |
?> |
| 19 |
|
| 20 |
<div class="wrap ws-ls-admin-page"> |
| 21 |
<?php |
| 22 |
if ( false === empty( $_POST['license-key'] ) ){ |
| 23 |
|
| 24 |
// First try validating and applying a new subscription license |
| 25 |
$valid_license = sh_cd_license_apply( $_POST['license-key'] ); |
| 26 |
|
| 27 |
if ( $valid_license ) { |
| 28 |
sh_cd_message_display( __('Your license has been applied!', SH_CD_SLUG ) ); |
| 29 |
} else { |
| 30 |
sh_cd_message_display(__('There was an error applying your license. ', SH_CD_SLUG ), true); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
$existing_license = ( true === SH_CD_IS_PREMIUM ) ? sh_cd_license() : NULL; |
| 35 |
|
| 36 |
if ( false === empty( $existing_license ) ) { |
| 37 |
$license_decoded = sh_cd_license_decode( $existing_license ); |
| 38 |
} |
| 39 |
|
| 40 |
?> |
| 41 |
<div id="icon-options-general" class="icon32"></div> |
| 42 |
<div id="poststuff"> |
| 43 |
<div id="post-body" class="metabox-holder columns-2"> |
| 44 |
<div id="post-body-content"> |
| 45 |
|
| 46 |
<div class="meta-box-sortables ui-sortable"> |
| 47 |
<div class="postbox"> |
| 48 |
<div class="postbox-header"> |
| 49 |
<h2 class="hndle"><span><?php echo __( 'Upgrade your license', SH_CD_SLUG ); ?> </span></h2> |
| 50 |
</div> |
| 51 |
<div class="inside"> |
| 52 |
<center> |
| 53 |
<h3><?php echo __( 'In case you need, your <strong>Site Hash</strong> is', SH_CD_SLUG ); ?>: <?php echo esc_html( $site_hash ) ; ?></h3> |
| 54 |
|
| 55 |
<?php |
| 56 |
|
| 57 |
if ( true === empty( $existing_license ) ) : |
| 58 |
|
| 59 |
sh_cd_upgrade_button(); |
| 60 |
?> |
| 61 |
<br /> <br /> |
| 62 |
<hr /> |
| 63 |
<h3><?php echo __( 'Premium Shortcodes', SH_CD_SLUG ); ?></h3> |
| 64 |
<p><?php echo __( 'Upgrade to the Premium version of Snippet Shortcodes and receive the following shortcodes', SH_CD_SLUG ); ?>:</p> |
| 65 |
|
| 66 |
<br /> |
| 67 |
<?php |
| 68 |
echo sh_cd_display_premade_shortcodes( 'premium' ); |
| 69 |
|
| 70 |
endif; |
| 71 |
?> |
| 72 |
</center> |
| 73 |
</div> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
</div> |
| 77 |
|
| 78 |
<div id="postbox-container-1" class="postbox-container"> |
| 79 |
|
| 80 |
<div class="meta-box-sortables"> |
| 81 |
|
| 82 |
<div class="postbox"> |
| 83 |
<div class="postbox-header"> |
| 84 |
<h2 class="hndle"><span><?php echo __( 'Add or Update License', SH_CD_SLUG ); ?> </span></h2> |
| 85 |
</div> |
| 86 |
<div class="inside"> |
| 87 |
|
| 88 |
<form action="<?php echo admin_url( 'admin.php?page=sh-cd-shortcode-variables-license&add-license=true' ); ?>" |
| 89 |
method="post"> |
| 90 |
<p><?php echo __( 'Copy and paste the license given to you by YeKen into this box and click "Apply License".', SH_CD_SLUG ); ?></p> |
| 91 |
<textarea rows="5" style="width:100%" name="license-key"></textarea> |
| 92 |
<br/><br/> |
| 93 |
<input type="submit" class="button-secondary large-text" value="<?php echo __( 'Apply License', SH_CD_SLUG ); ?>"/> |
| 94 |
</form> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
<div class="postbox"> |
| 98 |
<div class="postbox-header"> |
| 99 |
<h2 class="hndle"><span><?php echo __( 'Your license information', SH_CD_SLUG ); ?> </span></h2> |
| 100 |
</div> |
| 101 |
<div class="inside"> |
| 102 |
<table class="ws-ls-sidebar-stats"> |
| 103 |
<tr> |
| 104 |
<th><?php echo __( 'Site Hash', SH_CD_SLUG ); ?></th> |
| 105 |
<td><?php echo esc_html( sh_cd_generate_site_hash() ); ?></td> |
| 106 |
</tr> |
| 107 |
<tr> |
| 108 |
<th><?php echo __( 'Expires', SH_CD_SLUG ); ?></th> |
| 109 |
<td> |
| 110 |
<?php |
| 111 |
|
| 112 |
if( false === empty( $license_decoded['type'] ) && |
| 113 |
'sv-premium' === $license_decoded['type'] ) { |
| 114 |
|
| 115 |
$time = strtotime( $license_decoded['expiry-date'] ); |
| 116 |
$formatted = date( 'd/m/Y', $time ); |
| 117 |
|
| 118 |
echo esc_html( $formatted ); |
| 119 |
} else { |
| 120 |
echo __('No active license', SH_CD_SLUG); |
| 121 |
} |
| 122 |
|
| 123 |
?> |
| 124 |
</td> |
| 125 |
</tr> |
| 126 |
|
| 127 |
<?php if ( false === empty( $existing_license ) ): ?> |
| 128 |
<tr class="last"> |
| 129 |
<th colspan="2"><?php echo __( 'Your Existing License', SH_CD_SLUG ); ?></th> |
| 130 |
</tr> |
| 131 |
<tr class="last"> |
| 132 |
<td colspan="2"><textarea rows="5" style="width:100%"><?php echo esc_textarea( $existing_license ); ?></textarea></td> |
| 133 |
</tr> |
| 134 |
<tr class="last"> |
| 135 |
<td colspan="2"><a href="<?php echo admin_url('admin.php?page=sh-cd-shortcode-variables-license&remove-license=true'); ?>" class="button-secondary delete-license"><?php echo __( 'Remove License', SH_CD_SLUG ); ?></a></td> |
| 136 |
</tr> |
| 137 |
|
| 138 |
<?php endif; ?> |
| 139 |
</table> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
</div> |
| 143 |
</div> |
| 144 |
<div id="post-body" class="metabox-holder columns-3"> |
| 145 |
<div id="post-body-content"> |
| 146 |
<div class="meta-box-sortables ui-sortable"> |
| 147 |
|
| 148 |
</div> |
| 149 |
</div> |
| 150 |
<br class="clear"> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
|
| 154 |
<?php |
| 155 |
} |
| 156 |
?> |
| 157 |
|