Advertisement
thesufi

WordPress Theme License Checker

May 8th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. /*********************************************************************************************
  2. **********************************************************************************************
  3. ** WordPress Theme License Checker                              **
  4. ** Author: The Sufi                                     **
  5. ** Author URI: http://www.thedct.com                                **
  6. ** Version: 1.0                                         **
  7. **********************************************************************************************
  8. *********************************************************************************************/
  9. function check_point($key, $url){
  10.     $file = "http://www.yourserver.com/xmldirectory/05a0e40e81edc455d757dd8b40127581.xml";
  11.     $contents = file_get_contents($file);
  12.     if (!$contents){//file not found
  13.         wp_die('Error! Please contact theme support!');
  14.         exit;
  15.     }
  16.     $xml = new SimpleXMLElement($contents);
  17.     if ( $key == $xml->key && $url == $xml->domain ){
  18.         return true;
  19.     }
  20.     else return false;
  21. }
  22. $key = "ejhg789Xdfg";//you should retrieve this using a text box and save to wp_options table
  23. $domain = $_SERVER['HTTP_HOST'];//current domain
  24. $status = check_point($key, $domain);
  25. if (!$status){
  26.     wp_die('invalid theme license');
  27. }
  28. else{
  29. //here goes your original theme functions.php codes
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement