| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
class FrmFormTemplateApi extends FrmFormApi { |
| 7 |
|
| 8 |
protected static $code_option_name = 'frm_free_license_code'; |
| 9 |
|
| 10 |
private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/'; |
| 11 |
|
| 12 |
protected static $free_license; |
| 13 |
|
| 14 |
/** |
| 15 |
* @var int |
| 16 |
*/ |
| 17 |
protected $new_days = 30; |
| 18 |
|
| 19 |
/** |
| 20 |
* @var string |
| 21 |
*/ |
| 22 |
protected $cache_timeout = '+12 hours'; |
| 23 |
|
| 24 |
/** |
| 25 |
* @since 3.06 |
| 26 |
* |
| 27 |
* @return void |
| 28 |
*/ |
| 29 |
protected function set_cache_key() { |
| 30 |
$this->cache_key = 'frm_form_templates_l'; |
| 31 |
|
| 32 |
if ( ! empty( $this->license ) ) { |
| 33 |
$this->cache_key .= md5( $this->license ); |
| 34 |
} else { |
| 35 |
$this->cache_key .= '01fd72122f4a90f15684915c729d4368'; |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* @since 3.06 |
| 41 |
* |
| 42 |
* @return string |
| 43 |
*/ |
| 44 |
protected function api_url() { |
| 45 |
$url = self::$base_api_url . 'list'; |
| 46 |
|
| 47 |
if ( empty( $this->license ) ) { |
| 48 |
$url .= '?l=RlJFRVRFTVBMQVRFUyEhIQ%3D%3D&v=' . FrmAppHelper::plugin_version(); |
| 49 |
} |
| 50 |
|
| 51 |
return $url; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* @since 3.06 |
| 56 |
* |
| 57 |
* @return string[] |
| 58 |
*/ |
| 59 |
protected function skip_categories() { |
| 60 |
return array(); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* AJAX Hook for signing free users up for a template API key |
| 65 |
* |
| 66 |
* @return void |
| 67 |
*/ |
| 68 |
public static function signup() { |
| 69 |
_deprecated_function( __METHOD__, '6.20' ); |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* @return string |
| 74 |
*/ |
| 75 |
public function get_free_license() { |
| 76 |
_deprecated_function( __METHOD__, '6.20' ); |
| 77 |
return ''; |
| 78 |
} |
| 79 |
|
| 80 |
/** |
| 81 |
* Check to make sure the free code is being used. |
| 82 |
* |
| 83 |
* @since 4.09.02 |
| 84 |
* |
| 85 |
* @return bool |
| 86 |
*/ |
| 87 |
public function has_free_access() { |
| 88 |
_deprecated_function( __METHOD__, '6.20' ); |
| 89 |
return true; |
| 90 |
} |
| 91 |
} |
| 92 |
|