PluginProbe
Smart Forms – when you need more than just a contact form / trunk
Smart Forms – when you need more than just a contact form vtrunk
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / smart-forms-license.php

smart-forms-license.php in Smart Forms – when you need more than just a contact form trunk, at smart-forms-license.php

76 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function smart_forms_check_license($email,$key,&$error)
4 {
5 if($email!=null||$key!=null)
6 {
7 if(get_transient("smart_forms_check_again"))
8 return array("is_valid"=>true);
9
10 $result=smart_forms_license_is_valid($email,$key,$error);
11 if($result["is_valid"])
12 {
13 update_option('smart_forms_email',$email);
14 update_option('smart_forms_key',$key);
15 update_option('smart_forms_license',$result['licenseType']);
16
17 set_transient("smart_forms_check_again",1,60*60*24*7);
18 return $result;
19 }
20 }
21
22 return array("is_valid"=>false);
23 }
24
25 function smart_forms_check_license_with_options(&$error)
26 {
27 $result=apply_filters("smart_forms_lc_is_valid_with_options",array());
28 $error=$result["error"];
29 return $result;
30 }
31
32 function smart_forms_license_is_valid($email,$key,&$error)
33 {
34 $result = apply_filters( "smart_forms_lc_is_valid", array(
35 "email"=>$email,
36 "key"=>$key,
37 "is_valid"=>false,
38 "error"=>""
39 ) );
40
41 $error=$result["error"];
42 return $result;
43
44 }
45
46 function smart_forms_load_license_manager($errorMessage)
47 {
48 $result=apply_filters("smart_forms_lc_is_valid_with_options",array());
49 if($result["is_valid"])
50 {
51 ?><script language="javascript">
52 var RedNaoSmartFormLicenseIsValid=true;
53 var RedNaoSmartFormLicenseErrorMessage="";
54 var RedNaoLicenseType=<?php echo json_encode($result["licenseType"]);?>;
55 </script><?php
56 }else
57 {
58 wp_enqueue_script('jquery');
59 wp_enqueue_script('isolated-slider',SMART_FORMS_DIR_URL.'js/rednao-isolated-jq.js',array('jquery'));
60 wp_enqueue_style('smart-forms-Slider',SMART_FORMS_DIR_URL.'css/smartFormsSlider/jquery-ui-1.10.2.custom.min.css');
61
62 ?>
63 <script language="javascript">
64 var RedNaoSmartFormLicenseIsValid=false;
65 var RedNaoLicenseType="";
66 var RedNaoSmartFormLicenseErrorMessage="<?php echo $errorMessage?>";
67 </script>
68
69
70 <?php
71 }
72 wp_enqueue_script('rednao-smart-forms-licensing-manager',SMART_FORMS_DIR_URL.'js/licensing/rednao-licensing-manager.js',array('isolated-slider'));
73
74 }
75
76