Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.0.9.0
- * @ Author : DeZender
- * @ Release on : 08.08.2019
- * @ Official site : http://DeZender.Net
- *
- */
- function novus_license_menu()
- {
- add_theme_page('Licensed Theme', 'Licensed Theme', 'manage_options', 'licensed-theme', 'novus_license_page');
- }
- function novus_license_page()
- {
- $license = get_option('novus_license_key');
- $email = get_option('novus_license_email', '');
- $status = get_option('novus_license_key_status');
- echo "\r\n" . '<div class="wrap nosubsub">' . "\r\n\t" . '<h2>';
- _e('Licensed Theme Options');
- echo '</h2>' . "\r\n\t" . '<form method="post" id="sample-theme-verify">' . "\r\n\t\t" . '<input type="hidden" id="sample-theme-action" name="sample-theme-action" value="';
- echo novus_serial_valid() ? 'novus_license_deactivate' : 'novus_license_activate';
- echo '" />' . "\r\n\t\t" . '<table class="wp-list-table widefat tags ui-sortable">' . "\r\n" . ' ' . "\t" . '<tbody>' . "\r\n" . ' <tr>' . "\r\n" . ' ' . "\t" . '<td valign="top"><label for="sample-theme-license">License Key:</label></td>' . "\r\n" . ' <td>' . "\r\n" . ' ' . "\t" . '<input class="textfield" name="sample-theme-license" size="50" type="text" id="sample-theme-license" value="';
- echo $license;
- echo '" required />' . "\r\n" . ' <p class="description">';
- _e('Valid License to make All feature work correctly', 'wpls');
- echo '</p>' . "\r\n" . ' </td>' . "\r\n" . ' </tr>' . "\r\n" . ' <tr>' . "\r\n" . ' ' . "\t" . '<td valign="top"><label for="sample-theme-license">Email:</label></td>' . "\r\n" . ' <td>' . "\r\n" . ' ' . "\t" . '<input class="textfield" name="sample-theme-email" size="50" type="text" id="sample-theme-email" value="';
- echo $email;
- echo '" required />' . "\r\n" . ' <p class="description">';
- _e('Please provide your registered email with us', 'wpls');
- echo '</p>' . "\r\n" . ' </td>' . "\r\n\t\t\t\t" . '</tr>' . "\r\n\t\t\t\t" . '<tr>' . "\r\n" . ' ' . "\t" . '<td></td>' . "\r\n" . ' <td>' . "\r\n" . ' ' . "\t" . '<input type="submit" class="button-primary" id="saveS" name="saveS" value="';
- echo novus_serial_valid() ? __('Deactivate') : __('Activate');
- echo '">' . "\r\n" . ' <p class="pesan"></p>' . "\r\n" . ' </td>' . "\r\n\t\t\t\t" . '</tr>' . "\r\n" . ' <tr id="sample-status" style="';
- echo novus_serial_valid() ? '' : 'display:none;';
- echo '">' . "\r\n" . ' ' . "\t" . '<td colspan="2" id="td-status">' . "\r\n" . ' ' . "\t";
- echo '<pre>';
- echo print_r(novus_authorize_action($license, $email), 1);
- echo '</pre>';
- echo ' </td>' . "\r\n" . ' </tr>' . "\r\n\t\t\t" . '</tbody>' . "\r\n\t\t" . '</table>' . "\r\n\t" . '</form>' . "\r\n" . '</div>' . "\r\n\r\n";
- }
- function novus_check_serial_valid($action = 'validate')
- {
- $license = get_option('novus_license_key', '');
- $email = get_option('novus_license_email', '');
- $authorize = novus_authorize_action($serial, $email, $action);
- if ($authorize->valid) {
- return true;
- }
- return false;
- }
- function novus_authorize_action($purchase_code = '', $email = '', $action = 'validate')
- {
- global $wp_version;
- $domain = home_url();
- $api_params = ['wpls-verify' => $purchase_code, 'action' => $action, 'domain' => $domain, 'product' => NOVUS_THEME_CODE, 'validip' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']];
- $request = add_query_arg($api_params, NOVUS_STORE_URL);
- $response = wp_remote_post($request, [
- 'timeout' => 15,
- 'sslverify' => false,
- 'body' => ['code' => $purchase_code, 'email' => $email]
- ]);
- if (is_wp_error($response)) {
- return false;
- }
- $authorize_data = json_decode(wp_remote_retrieve_body($response));
- if (empty($authorize_data) || ($authorize_data === NULL) || ($authorize_data === false)) {
- return false;
- }
- update_option('novus_license_key_status', $authorize_data->valid);
- return $authorize_data;
- }
- function novus_serial_valid()
- {
- return get_option('novus_license_key_status', false);
- }
- function novus_verify_js()
- {
- echo '<script>' . "\r\n\t" . 'jQuery(\'#sample-theme-verify\').on(\'submit\', function(e){' . "\r\n\t\t" . 'e.preventDefault();' . "\r\n\t\t" . 'var action = jQuery(\'#sample-theme-action\').val(),' . "\r\n\t\t\t" . 'email = jQuery(\'#sample-theme-email\').val(),' . "\r\n\t\t\t" . 'code = jQuery(\'#sample-theme-license\').val();' . "\r\n\t\t\t\r\n\t\t" . 'jQuery.ajax({' . "\r\n\t\t\t" . 'type: "POST",' . "\r\n\t\t\t" . 'url : \'';
- echo admin_url('admin-ajax.php');
- echo '\',' . "\r\n\t\t\t" . 'data: {\'action\' : action, \'email\' : email, \'code\': code},' . "\r\n\t\t\t" . 'beforeSend: function(){' . "\r\n\t\t\t\t" . 'jQuery(\'#saveS\').prop(\'disabled\', true).val(\'Please wait..\');' . "\r\n\t\t\t" . '},' . "\r\n\t\t\t" . 'success : function(data){' . "\r\n\t\t\t\t" . 'var btn_value = \'Activate\';' . "\r\n\t\t\t\t" . 'if( data ){' . "\r\n\t\t\t\t\t" . 'if(data.valid){' . "\r\n\t\t\t\t\t\t" . 'if(action == \'novus_license_activate\'){' . "\r\n\t\t\t\t\t\t\t" . 'var btn_value = \'Deactivate\';' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'#sample-theme-action\').val(\'novus_license_deactivate\');' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'.pesan\').html(\'<span style="color:green;">Congratulation, your license already activated</span>\');' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'tr#sample-status\').load(window.location.href + \' #td-status\').show();' . "\r\n\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . 'else{' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'#sample-theme-action\').val(\'novus_license_activate\');' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'#sample-theme-license\').val(\'\');' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'#sample-theme-email\').val(\'\');' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'.pesan\').html(\'<span style="color:green;">Congratulation, your license successful deactivated</span>\');' . "\r\n\t\t\t\t\t\t\t" . 'jQuery(\'tr#sample-status\').load(window.location.href + \' #td-status\').hide();' . "\r\n\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t" . 'location.reload();' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'else {' . "\r\n\t\t\t\t\t\t" . 'jQuery(\'.pesan\').html(\'<span style="color:red;">\'+data.info.message+\'</span>\');' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t\t\r\n\t\t\t\t" . 'jQuery(\'#saveS\').prop(\'disabled\', false).val(btn_value);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '});' . "\r\n\t" . '});' . "\r\n" . '</script>' . "\r\n\r\n";
- }
- function novus_license_activate()
- {
- if (isset($_POST['email']) && isset($_POST['code'])) {
- $return = novus_authorize_action($_POST['code'], $_POST['email'], 'activate');
- if ($return->valid) {
- update_option('novus_license_key', $_POST['code']);
- update_option('novus_license_email', $_POST['email']);
- }
- header('Content-type: application/json');
- echo json_encode($return, JSON_PRETTY_PRINT);
- exit();
- }
- }
- function novus_license_deactivate()
- {
- if (isset($_POST['email']) && isset($_POST['code'])) {
- $return = novus_authorize_action($_POST['code'], $_POST['email'], 'deactivate');
- if ($return->valid) {
- update_option('novus_license_key', '');
- update_option('novus_license_email', '');
- update_option('novus_license_key_status', false);
- }
- header('Content-type: application/json');
- echo json_encode($return, JSON_PRETTY_PRINT);
- ....................................................................................
- ...............................................
- ...................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement