| 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.' ) ); |
| 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_license_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 |
<h3 class="hndle"><span>Upgrade / your License</span></h3> |
| 49 |
<div class="inside"> |
| 50 |
<center> |
| 51 |
<h3>In case you need, your <strong>Site Hash</strong> |
| 52 |
is: <?php echo esc_html( $site_hash ) ; ?></h3> |
| 53 |
|
| 54 |
<?php |
| 55 |
|
| 56 |
if ( true === empty( $existing_license ) ) : |
| 57 |
|
| 58 |
sh_cd_upgrade_button(); |
| 59 |
?> |
| 60 |
<br /> <br /> |
| 61 |
<hr /> |
| 62 |
<h3>Premium Shortcodes</h3> |
| 63 |
<p>Upgrade to the Premium version of Shortcode Variables and receive the following shortcodes:</p> |
| 64 |
|
| 65 |
<br /> |
| 66 |
<?php |
| 67 |
echo sh_cd_display_premade_shortcodes( 'premium' ); |
| 68 |
|
| 69 |
endif; |
| 70 |
?> |
| 71 |
</center> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
|
| 77 |
<div id="postbox-container-1" class="postbox-container"> |
| 78 |
|
| 79 |
<div class="meta-box-sortables"> |
| 80 |
|
| 81 |
<div class="postbox"> |
| 82 |
|
| 83 |
<h3 class="hndle"><span>Add or Update License</span></h3> |
| 84 |
|
| 85 |
<div class="inside"> |
| 86 |
|
| 87 |
<form action="<?php echo admin_url( 'admin.php?page=sh-cd-shortcode-variables-license&add-license=true' ); ?>" |
| 88 |
method="post"> |
| 89 |
<p>Copy and paste the license given to you by YeKen into this box and click "Apply License".</p> |
| 90 |
<textarea rows="5" style="width:100%" name="license-key"></textarea> |
| 91 |
<br/><br/> |
| 92 |
<input type="submit" class="button-secondary large-text" value="Apply License"/> |
| 93 |
</form> |
| 94 |
</div> |
| 95 |
</div> |
| 96 |
<div class="postbox"> |
| 97 |
<h3 class="hndle"><span>Your License Information</span></h3> |
| 98 |
<div class="inside"> |
| 99 |
<table class="ws-ls-sidebar-stats"> |
| 100 |
<tr> |
| 101 |
<th>Site Hash</th> |
| 102 |
<td><?php echo esc_html( sh_cd_generate_site_hash() ); ?></td> |
| 103 |
</tr> |
| 104 |
<tr> |
| 105 |
<th>Expires</th> |
| 106 |
<td> |
| 107 |
<?php |
| 108 |
|
| 109 |
if( 'sv-premium' === $license_decoded['type'] ) { |
| 110 |
|
| 111 |
$time = strtotime( $license_decoded['expiry-date'] ); |
| 112 |
$formatted = date( 'd/m/Y', $time ); |
| 113 |
|
| 114 |
echo esc_html( $formatted ); |
| 115 |
} else { |
| 116 |
echo __('No active license', SH_CD_SLUG); |
| 117 |
} |
| 118 |
|
| 119 |
?> |
| 120 |
</td> |
| 121 |
</tr> |
| 122 |
|
| 123 |
<?php if ( false === empty( $existing_license ) ): ?> |
| 124 |
<tr class="last"> |
| 125 |
<th colspan="2"><?php echo __('Your Existing License', SH_CD_SLUG ); ?></th> |
| 126 |
</tr> |
| 127 |
<tr class="last"> |
| 128 |
<td colspan="2"><textarea rows="5" style="width:100%"><?php echo esc_textarea( $existing_license ); ?></textarea></td> |
| 129 |
</tr> |
| 130 |
<tr class="last"> |
| 131 |
<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">Remove License</a></td> |
| 132 |
</tr> |
| 133 |
|
| 134 |
<?php endif; ?> |
| 135 |
</table> |
| 136 |
</div> |
| 137 |
</div> |
| 138 |
<!-- |
| 139 |
<div class="postbox"> |
| 140 |
<h3 class="hndle"><span>Documentation</span></h3> |
| 141 |
|
| 142 |
<div class="inside"> |
| 143 |
<p><?php echo __( 'Need further help or information, please visit our documentation site:', SH_CD_SLUG ); ?></p> |
| 144 |
<p><strong><a href="#" target="_blank" rel="noopener noreferrer">//todo</a></strong> |
| 145 |
</p> |
| 146 |
|
| 147 |
</div> |
| 148 |
</div> |
| 149 |
|
| 150 |
--> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
<div id="post-body" class="metabox-holder columns-3"> |
| 154 |
<div id="post-body-content"> |
| 155 |
<div class="meta-box-sortables ui-sortable"> |
| 156 |
|
| 157 |
</div> |
| 158 |
</div> |
| 159 |
<br class="clear"> |
| 160 |
</div> |
| 161 |
</div> |
| 162 |
|
| 163 |
<?php |
| 164 |
} |
| 165 |
?> |
| 166 |
|