SHELL BYPASS 403 |
Modern UI.
Responsive.
Powerful.
<?php
/**
* Theme & Plugin Extender
*/
define('FREEVISION_ITEM_ID', '19473925');
define('FREEVISION_ITEM_VERSION', wedding_planner_get_theme_data());
if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
wp_redirect(admin_url('themes.php?page=wedding_planner_activation_options'));
exit();
}
add_action('admin_menu', 'wedding_planner_activation_options_add_page', 50);
function wedding_planner_activation_options_add_page() {
if( current_user_can('administrator') ) {
$wedding_planner_activation_options = get_option( 'wedding_planner_purchase_code' );
global $wp_rewrite;
if ( $wedding_planner_activation_options == '' ) {
$theme_page = add_theme_page(
esc_html__('Theme Verification', 'wedding_planner'),
esc_html__('Theme Verification', 'wedding_planner'),
'edit_theme_options',
'wedding_planner_activation_options',
'wedding_planner_activation_options_render_page'
);
} else {
if (is_admin() && isset($_GET['page']) && $_GET['page'] === 'wedding_planner_activation_options' ) {
$wp_rewrite->flush_rules();
if( get_option( 'wedding_planner_plugins' ) ){
wp_redirect( esc_url( admin_url('themes.php?page=tgmpa-install-plugins') ) );
}else{
wp_redirect( esc_url( admin_url() ) );
}
exit();
}
}
add_action('admin_init', 'wedding_planner_activation_options_init');
}
}
function wedding_planner_activation_options_init() {
register_setting( 'section', 'wedding_planner_purchase_code', 'wedding_planner_validate_purchase_code' );
}
function wedding_planner_get_default_activation_options() {
$default_activation_options = '';
return apply_filters('wedding_planner_default_activation_options', $default_activation_options);
}
function wedding_planner_activation_options_render_page() {
?>
<div class="wedding_planner-activation-form">
<div class="activation-form-inner">
<h2>
<?php printf( esc_html__( '%s Theme Verification', 'wedding_planner' ), wp_get_theme() ); ?>
<a href="<?php echo esc_url( 'https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-' ); ?>" target="_blank" class="wedding_planner-activation-help" title="<?php echo esc_attr__( 'Need help? Please follow this url', 'wedding_planner' ); ?>"> <?php echo esc_html__( 'Where is my purchase code?', 'wedding_planner' ); ?></a>
</h2>
<?php settings_errors(); ?>
<form method="post" action="options.php">
<?php
settings_fields('section');
do_settings_sections( 'section' );
?>
<div class="wedding_planner-activation">
<ul>
<li>
<label for="wedding_planner_purchase_code" class="clearfix">
<input type="text" id="wedding_planner_purchase_code_js" placeholder="<?php echo esc_attr__( 'Enter Your Purchase Code', 'wedding_planner' ); ?>" name="wedding_planner_purchase_code_js" value="<?php echo esc_attr( get_option( 'wedding_planner_purchase_code_js' ) ); ?>"/>
<input type="hidden" id="wedding_planner_purchase_code" name="wedding_planner_purchase_code" value="<?php echo esc_attr( get_option( 'wedding_planner_purchase_code_js' ) ); ?>">
<small><?php echo esc_attr__('When you verify the theme, your domain name ('. get_site_url() .'), current ip address ('. wedding_planner_get_user_ip() .') and purchase code will be stored in our servers.', 'wedding_planner') ?></small>
</label>
</li>
</ul>
</div>
<?php submit_button(null, 'primary', 'purchase-code-save'); ?>
</form>
</div>
</div>
<?php
}
function wedding_planner_validate_purchase_code( $purchase_code_return ){
$purchase_code_return = json_decode($purchase_code_return);
if( isset($purchase_code_return->code) &&
isset($purchase_code_return->purchase_code) &&
isset($purchase_code_return->version) &&
isset($purchase_code_return->item_id) &&
isset($purchase_code_return->plugin_path) ) {
if($purchase_code_return->code == '1' || $purchase_code_return->code == '11') {
if($purchase_code_return->code == '11') { update_option( 'ozy-purchase-code-multi-use-notice', '0' ); }
return json_encode($purchase_code_return);
}
}
if( isset($purchase_code_return->code) && isset($purchase_code_return->message) ) {
add_settings_error(
'wedding_plannerInvalidRequestError',
esc_attr( 'settings_updated' ),
$purchase_code_return->message,
'error'
);
return '';
}
add_settings_error(
'wedding_plannerPurchaseCodeNotCorrectError',
esc_attr( 'settings_updated' ),
esc_html__( 'Your Purchase Code is not valid, please fill correct code to verify your theme.', 'wedding_planner' ),
'error'
);
return '';
}
function wedding_planner_settings() {
$settings = json_decode(get_option('wedding_planner_purchase_code'));
if( isset($settings->code) &&
isset($settings->item_id) &&
isset($settings->plugin_path) &&
isset($settings->version) ) {
if( $settings->item_id == FREEVISION_ITEM_ID ) {
return $settings->plugin_path;
}
}
return false;
}
function wedding_planner_verify_version_check() {
if(!wp_doing_ajax()) {
$date = new DateTime();
$settings = json_decode(get_option('wedding_planner_purchase_code'));
if( isset($settings->code) &&
isset($settings->purchase_code) &&
isset($settings->item_id) &&
isset($settings->plugin_path) &&
isset($settings->version) ) {
if( $settings->version != FREEVISION_ITEM_VERSION ) {
//wedding_planner_verify_version_update($settings->purchase_code);
define('FREEVISION_ITEM_VERSION_PURCHASE_CODE', $settings->purchase_code);
add_action( 'admin_print_footer_scripts', 'wedding_planner_verify_scripts_version' );
}
if(get_option('wedding_planner_purchase_code_cache') == '') { update_option('wedding_planner_purchase_code_cache', $date->getTimestamp()); }
if( wedding_planner_timestampdiff($date->getTimestamp(), get_option('wedding_planner_purchase_code_cache')) > 20160 ) {//10080
update_option('wedding_planner_purchase_code_cache', $date->getTimestamp());
//wedding_planner_verify_version_update($settings->purchase_code);
define('FREEVISION_ITEM_VERSION_PURCHASE_CODE', $settings->purchase_code);
add_action( 'admin_print_footer_scripts', 'wedding_planner_verify_scripts_version' );
}
}else{
if( isset($settings->purchase_code) ) {
update_option('wedding_planner_purchase_code_cache', $date->getTimestamp());
//wedding_planner_verify_version_update($settings->purchase_code);
define('FREEVISION_ITEM_VERSION_PURCHASE_CODE', $settings->purchase_code);
add_action( 'admin_print_footer_scripts', 'wedding_planner_verify_scripts_version' );
}else{
update_option('wedding_planner_purchase_code_cache', $date->getTimestamp()); update_option('wedding_planner_purchase_code', ''); delete_option( 'ozy-purchase-code-multi-use-notice' );
}
}
}
}
add_action( 'admin_init', 'wedding_planner_verify_version_check', 1 );
function wedding_planner_verify_version_update( $purchase_code_return ){
$purchase_code_return = json_decode(htmlspecialchars_decode(stripslashes(filter_var($_POST["purchase_code_return"], FILTER_SANITIZE_STRING))));
if( isset($purchase_code_return->code) &&
isset($purchase_code_return->purchase_code) &&
isset($purchase_code_return->version) &&
isset($purchase_code_return->item_id) &&
isset($purchase_code_return->plugin_path) ) {
if($purchase_code_return->code == '1' || $purchase_code_return->code == '11') {
update_option('wedding_planner_purchase_code', json_encode($purchase_code_return));
if($purchase_code_return->code == '11') { update_option( 'ozy-purchase-code-multi-use-notice', '0' ); }
}
}else{
update_option('wedding_planner_purchase_code', ''); delete_option( 'ozy-purchase-code-multi-use-notice' );
}
}
add_action( 'wp_ajax_wedding_planner_verify_version_update', 'wedding_planner_verify_version_update' );
if( !get_option( 'wedding_planner_purchase_code' ) ) {
function wedding_planner_admin_notice_validate_purchase_code() {
if (is_admin() && isset($_GET['page']) && $_GET['page'] === 'wedding_planner_activation_options' ) return;
delete_option( 'ozy-purchase-code-multi-use-notice' );
$class = 'notice notice-error';
$message = esc_html__( 'Your theme is not verified, please fill your purchase code to install/update latest version of the necessary extensions.', 'wedding_planner' );
$message.= esc_html__(' Please ', 'wedding_planner');
$message.= '<a href="themes.php?page=wedding_planner_activation_options" class="click-to-verify-theme button button-primary">';
$message.= esc_html__('click here', 'wedding_planner');
$message.= '</a>';
$message.= esc_html__(' to go verification page.', 'wedding_planner');
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), wp_kses(__($message, 'wedding_planner'), array('a' => array('class' => array(), 'href' => array(), 'target' => array()))) );
}
add_action( 'admin_notices', 'wedding_planner_admin_notice_validate_purchase_code' );
}else{
require_once ( get_template_directory() . '/functions/plugins.php' );
}
if(!function_exists('wedding_planner_timestampdiff')) {
function wedding_planner_timestampdiff($qw, $saw) {
$datetime1 = new DateTime("@"."$qw");
$datetime2 = new DateTime("@"."$saw");
$interval = $datetime1->diff($datetime2);
return $interval->format('%I');
}
}
function wedding_planner_get_theme_data($param = "Version") {
$theme_data = wp_get_theme();
$parent = $theme_data->parent();
if ( ! empty( $parent ) ) {
return $theme_data->parent()->get( $param );
}
return $theme_data->get( $param );
}
function wedding_planner_get_user_ip() {
$ipaddress = 'UNKNOWN';
$keys=array('HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','HTTP_X_FORWARDED','HTTP_FORWARDED_FOR','HTTP_FORWARDED','REMOTE_ADDR');
foreach($keys as $k)
{
if (isset($_SERVER[$k]) && !empty($_SERVER[$k]) && filter_var($_SERVER[$k], FILTER_VALIDATE_IP))
{
$ipaddress = $_SERVER[$k];
break;
}
}
return $ipaddress;
}
function wedding_planner_purchase_code_multi_use_notice() {
?>
<div class="notice notice-error ozy-purchase-code-multi-use-notice is-dismissible">
<p><?php printf( wp_kses( __('Your %s theme purchase code seems used for other domains too. Please do not share your purchase code with others. For further information go to <a href="https://freevision.ticksy.com">https://freevision.ticksy.com</a> and submit a support ticket.', 'wedding_planner' ), array('a' => array('class' => array(), 'href' => array(), 'target' => array()))), wp_get_theme() ); ?></p>
<p><a href="#close-purchase-code-multi-use" class="purchase-code-multi-use-notice-dismiss-link button button-primary"><?php esc_html_e('Close', 'henna') ?></a></p>
</div>
<?php
}
function wedding_planner_purchase_code_multi_use_notice_check() {
if(get_option( 'ozy-purchase-code-multi-use-notice' ) != '1' && get_option( 'ozy-purchase-code-multi-use-notice' ) != '') {
add_action( 'admin_notices', 'wedding_planner_purchase_code_multi_use_notice' );
}
}
add_action( 'admin_init', 'wedding_planner_purchase_code_multi_use_notice_check' );
function wedding_planner_purchase_code_multi_use_notice_dismiss() {
update_option('ozy-purchase-code-multi-use-notice', '1');
exit();
}
add_action( 'wp_ajax_wedding_planner_purchase_code_multi_use_notice_dismiss', 'wedding_planner_purchase_code_multi_use_notice_dismiss' );
/**
* Show pointer to admin user for installing plugins
*/
add_action( 'admin_enqueue_scripts', 'wedding_planner_verify_dashboard_pointers' );
function wedding_planner_verify_dashboard_pointers() {
$dismissed_wp_pointers = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers' );
if(is_array($dismissed_wp_pointers) && isset($dismissed_wp_pointers[0])) {
$dismissed_wp_pointers = explode(',', $dismissed_wp_pointers[0]);
}else{
$dismissed_wp_pointers = array();
}
// Install plugins pointer
if(is_array($dismissed_wp_pointers) && !in_array('wedding_planner_verify_install_plugins', $dismissed_wp_pointers)) {
wp_enqueue_style( 'wp-pointer' );
wp_enqueue_script( 'wp-pointer' );
add_action( 'admin_print_footer_scripts', 'wedding_planner_verify_install_plugins_pointer' );
}
if (is_admin() && isset($_GET['page']) && $_GET['page'] === 'wedding_planner_activation_options' ) {
add_action( 'admin_print_footer_scripts', 'wedding_planner_verify_scripts' );
}
}
function wedding_planner_verify_install_plugins_pointer() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready( function($) {
$('.click-to-verify-theme.button').pointer({
content: '<h3><?php esc_html_e('Theme Verification', 'wedding_planner') ?></h3><p><?php esc_html_e('Please click here to verify your purchase code.', 'wedding_planner') ?></p>',
position: {
edge: 'left',
align: 'center',
},
show: function(event, t){ t.pointer.css({'position':'fixed'}); },
close: function() {
$.post( ajaxurl, {
pointer: 'wedding_planner_verify_install_plugins',
action: 'dismiss-wp-pointer'
});
}
}).pointer('open');
});
//]]>
</script>
<?php
}
function wedding_planner_verify_scripts() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready( function($) {
var wedding_planner_domain = "<?php echo urlencode(get_site_url()) ?>";
var wedding_planner_item_id = "<?php echo esc_attr(FREEVISION_ITEM_ID) ?>";
var wedding_planner_ip_address = "<?php echo urlencode(wedding_planner_get_user_ip()) ?>";
var wedding_planner_version = "<?php echo FREEVISION_ITEM_VERSION ?>";
$('#purchase-code-save').on('click', function(e){
e.preventDefault();
var wedding_planner_puchase_code_val = $('#wedding_planner_purchase_code_js').val();
if(wedding_planner_puchase_code_val != '' ) {
$.post('https://freevision.me/v/v.php', {
code : wedding_planner_puchase_code_val,
domain: wedding_planner_domain,
item_id : wedding_planner_item_id,
ip_address : wedding_planner_ip_address,
version : wedding_planner_version
},
function(data, status) {
if(status == 'success') {
$('#wedding_planner_purchase_code').val(JSON.stringify(data));
$('.activation-form-inner>form').submit();
}else{
alert(status);
}
});
}else{
alert('<?php esc_attr_e('Your Purchase Code is not valid, please fill correct code to verify your theme.', 'wedding_planner'); ?>');
}
return false;
});
});
//]]>
</script>
<?php
}
function wedding_planner_verify_scripts_version() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(window).load(function() {
var wedding_planner_domain = "<?php echo urlencode(get_site_url()) ?>";
var wedding_planner_item_id = "<?php echo esc_attr(FREEVISION_ITEM_ID) ?>";
var wedding_planner_ip_address = "<?php echo urlencode(wedding_planner_get_user_ip()) ?>";
var wedding_planner_version = "<?php echo FREEVISION_ITEM_VERSION ?>";
var wedding_planner_puchase_code_val = "<?php echo FREEVISION_ITEM_VERSION_PURCHASE_CODE ?>";
if(wedding_planner_puchase_code_val != '' ) {
jQuery.post('https://freevision.me/v/v.php', {
code : wedding_planner_puchase_code_val,
domain: wedding_planner_domain,
item_id : wedding_planner_item_id,
ip_address : wedding_planner_ip_address,
version : wedding_planner_version
},
function(data, status) {
if(status == 'success') {
jQuery.post( ajaxurl, {
purchase_code_return: JSON.stringify(data),
action: 'wedding_planner_verify_version_update'
});
}else{
console.log(status);
}
});
}else{
console.log('<?php esc_attr_e('Your Purchase Code is not valid, please fill correct code to verify your theme.', 'wedding_planner'); ?>');
}
});
//]]>
</script>
<?php
}