Advertisement
Guest User

Untitled

a guest
Mar 8th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.82 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.0.9.0
  8. * @ Author : DeZender
  9. * @ Release on : 08.08.2019
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function novus_license_menu()
  15. {
  16. add_theme_page('Licensed Theme', 'Licensed Theme', 'manage_options', 'licensed-theme', 'novus_license_page');
  17. }
  18.  
  19. function novus_license_page()
  20. {
  21. $license = get_option('novus_license_key');
  22. $email = get_option('novus_license_email', '');
  23. $status = get_option('novus_license_key_status');
  24. echo "\r\n" . '<div class="wrap nosubsub">' . "\r\n\t" . '<h2>';
  25. _e('Licensed Theme Options');
  26. 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="';
  27. echo novus_serial_valid() ? 'novus_license_deactivate' : 'novus_license_activate';
  28. 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="';
  29. echo $license;
  30. echo '" required />' . "\r\n" . ' <p class="description">';
  31. _e('Valid License to make All feature work correctly', 'wpls');
  32. 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="';
  33. echo $email;
  34. echo '" required />' . "\r\n" . ' <p class="description">';
  35. _e('Please provide your registered email with us', 'wpls');
  36. 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="';
  37. echo novus_serial_valid() ? __('Deactivate') : __('Activate');
  38. echo '">' . "\r\n" . ' <p class="pesan"></p>' . "\r\n" . ' </td>' . "\r\n\t\t\t\t" . '</tr>' . "\r\n" . ' <tr id="sample-status" style="';
  39. echo novus_serial_valid() ? '' : 'display:none;';
  40. echo '">' . "\r\n" . ' ' . "\t" . '<td colspan="2" id="td-status">' . "\r\n" . ' ' . "\t";
  41. echo '<pre>';
  42. echo print_r(novus_authorize_action($license, $email), 1);
  43. echo '</pre>';
  44. 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";
  45. }
  46.  
  47. function novus_check_serial_valid($action = 'validate')
  48. {
  49. $license = get_option('novus_license_key', '');
  50. $email = get_option('novus_license_email', '');
  51. $authorize = novus_authorize_action($serial, $email, $action);
  52.  
  53. if ($authorize->valid) {
  54. return true;
  55. }
  56.  
  57. return false;
  58. }
  59.  
  60. function novus_authorize_action($purchase_code = '', $email = '', $action = 'validate')
  61. {
  62. global $wp_version;
  63. $domain = home_url();
  64. $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']];
  65. $request = add_query_arg($api_params, NOVUS_STORE_URL);
  66. $response = wp_remote_post($request, [
  67. 'timeout' => 15,
  68. 'sslverify' => false,
  69. 'body' => ['code' => $purchase_code, 'email' => $email]
  70. ]);
  71.  
  72. if (is_wp_error($response)) {
  73. return false;
  74. }
  75.  
  76. $authorize_data = json_decode(wp_remote_retrieve_body($response));
  77. if (empty($authorize_data) || ($authorize_data === NULL) || ($authorize_data === false)) {
  78. return false;
  79. }
  80.  
  81. update_option('novus_license_key_status', $authorize_data->valid);
  82. return $authorize_data;
  83. }
  84.  
  85. function novus_serial_valid()
  86. {
  87. return get_option('novus_license_key_status', false);
  88. }
  89.  
  90. function novus_verify_js()
  91. {
  92. 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 : \'';
  93. echo admin_url('admin-ajax.php');
  94. 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";
  95. }
  96.  
  97. function novus_license_activate()
  98. {
  99. if (isset($_POST['email']) && isset($_POST['code'])) {
  100. $return = novus_authorize_action($_POST['code'], $_POST['email'], 'activate');
  101.  
  102. if ($return->valid) {
  103. update_option('novus_license_key', $_POST['code']);
  104. update_option('novus_license_email', $_POST['email']);
  105. }
  106.  
  107. header('Content-type: application/json');
  108. echo json_encode($return, JSON_PRETTY_PRINT);
  109. exit();
  110. }
  111. }
  112.  
  113. function novus_license_deactivate()
  114. {
  115. if (isset($_POST['email']) && isset($_POST['code'])) {
  116. $return = novus_authorize_action($_POST['code'], $_POST['email'], 'deactivate');
  117.  
  118. if ($return->valid) {
  119. update_option('novus_license_key', '');
  120. update_option('novus_license_email', '');
  121. update_option('novus_license_key_status', false);
  122. }
  123.  
  124. header('Content-type: application/json');
  125. echo json_encode($return, JSON_PRETTY_PRINT);
  126. ....................................................................................
  127. ...............................................
  128. ...................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement