/freemius/config.php

  1. <?php 
  2. /** 
  3. * @package Freemius 
  4. * @copyright Copyright (c) 2015, Freemius, Inc. 
  5. * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License 
  6. * @since 1.0.4 
  7. */ 
  8.  
  9. if ( ! defined( 'ABSPATH' ) ) { 
  10. exit; 
  11.  
  12. define( 'WP_FS__SLUG', 'freemius' ); 
  13. if ( ! defined( 'WP_FS__DEV_MODE' ) ) { 
  14. define( 'WP_FS__DEV_MODE', false ); 
  15.  
  16. /** 
  17. * API Connectivity Simulation 
  18. */ 
  19. if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY' ) ) { 
  20. define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY', false ); 
  21. if ( ! defined( 'WP_FS__SIMULATE_NO_CURL' ) ) { 
  22. define( 'WP_FS__SIMULATE_NO_CURL', false ); 
  23. if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) { 
  24. define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false ); 
  25. if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) { 
  26. define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false ); 
  27. if ( WP_FS__SIMULATE_NO_CURL ) { 
  28. define( 'FS_SDK__SIMULATE_NO_CURL', true ); 
  29. if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) { 
  30. define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', true ); 
  31. if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) { 
  32. define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', true ); 
  33.  
  34. if ( ! defined( 'WP_FS__SIMULATE_FREEMIUS_OFF' ) ) { 
  35. define( 'WP_FS__SIMULATE_FREEMIUS_OFF', false ); 
  36.  
  37. if ( ! defined( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES' ) ) { 
  38. /** 
  39. * @since 1.1.7.3 
  40. * @author Vova Feldman (@svovaf) 
  41. * 
  42. * I'm not sure if shared servers periodically change IP, or the subdomain of the 
  43. * admin dashboard. Also, I've seen sites that have strange loop of switching 
  44. * between domains on a daily basis. Therefore, to eliminate the risk of 
  45. * multiple unwanted connectivity test pings, temporary ignore domain or 
  46. * server IP changes. 
  47. */ 
  48. define( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES', false ); 
  49.  
  50. /** 
  51. * If your dev environment supports custom public network IP setup 
  52. * like VVV, please update WP_FS__LOCALHOST_IP with your public IP 
  53. * and uncomment it during dev. 
  54. */ 
  55. if ( ! defined( 'WP_FS__LOCALHOST_IP' ) ) { 
  56. // VVV default public network IP. 
  57. define( 'WP_FS__VVV_DEFAULT_PUBLIC_IP', '192.168.50.4' ); 
  58.  
  59. // define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP ); 
  60.  
  61. /** 
  62. * If true and running with secret key, the opt-in process 
  63. * will skip the email activation process which is invoked 
  64. * when the email of the context user already exist in Freemius 
  65. * database (as a security precaution, to prevent sharing user 
  66. * secret with unauthorized entity). 
  67. * 
  68. * IMPORTANT: 
  69. * AS A SECURITY PRECAUTION, WE VALIDATE THE TIMESTAMP OF THE OPT-IN REQUEST. 
  70. * THEREFORE, MAKE SURE THAT WHEN USING THIS PARAMETER, YOUR TESTING ENVIRONMENT'S 
  71. * CLOCK IS SYNCED. 
  72. */ 
  73. if ( ! defined( 'WP_FS__SKIP_EMAIL_ACTIVATION' ) ) { 
  74. define( 'WP_FS__SKIP_EMAIL_ACTIVATION', false ); 
  75.  
  76.  
  77. /** 
  78. * Directories 
  79. */ 
  80. define( 'WP_FS__DIR', dirname( __FILE__ ) ); 
  81. define( 'WP_FS__DIR_INCLUDES', WP_FS__DIR . '/includes' ); 
  82. define( 'WP_FS__DIR_TEMPLATES', WP_FS__DIR . '/templates' ); 
  83. define( 'WP_FS__DIR_ASSETS', WP_FS__DIR . '/assets' ); 
  84. define( 'WP_FS__DIR_CSS', WP_FS__DIR_ASSETS . '/css' ); 
  85. define( 'WP_FS__DIR_JS', WP_FS__DIR_ASSETS . '/js' ); 
  86. define( 'WP_FS__DIR_IMG', WP_FS__DIR_ASSETS . '/img' ); 
  87. define( 'WP_FS__DIR_SDK', WP_FS__DIR_INCLUDES . '/sdk' ); 
  88.  
  89.  
  90. /** 
  91. * Domain / URL / Address 
  92. */ 
  93. define( 'WP_FS__DOMAIN_PRODUCTION', 'wp.freemius.com' ); 
  94. define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION ); 
  95.  
  96. if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) { 
  97. define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' ); 
  98. if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) { 
  99. define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' ); 
  100.  
  101. if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) { 
  102. define( 'WP_FS__TESTING_DOMAIN', 'fswp' ); 
  103.  
  104. if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) { 
  105. define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius:8080' ); 
  106. if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) { 
  107. define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' ); 
  108.  
  109. define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) ); 
  110. define( 'WP_FS__REMOTE_ADDR', fs_get_ip() ); 
  111.  
  112. if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) { 
  113. // By default, run with Freemius production servers. 
  114. define( 'WP_FS__IS_PRODUCTION_MODE', true ); 
  115.  
  116. define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) ); 
  117.  
  118. if ( defined( 'WP_FS__LOCALHOST_IP' ) ) { 
  119. define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) ); 
  120. } else { 
  121. define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST && 
  122. is_string( WP_FS__REMOTE_ADDR ) && 
  123. ( substr( WP_FS__REMOTE_ADDR, 0, 4 ) == '127.' || 
  124. WP_FS__REMOTE_ADDR == '::1' ) 
  125. ); 
  126.  
  127. define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST || 
  128. false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) ); 
  129.  
  130. // Set API address for local testing. 
  131. if ( ! WP_FS__IS_PRODUCTION_MODE ) { 
  132. define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST ); 
  133. define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST ); 
  134.  
  135. define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' ); 
  136.  
  137. if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) { 
  138. define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' ); 
  139. if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) { 
  140. define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' ); 
  141. define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' ); 
  142.  
  143. define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST && 
  144. // Checks if CloudFlare's HTTPS (Flexible SSL support) 
  145. isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) || 
  146. // Check if HTTPS request. 
  147. ( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) || 
  148. ( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] ) 
  149. ); 
  150.  
  151. define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST && 
  152. strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) ); 
  153.  
  154. /** 
  155. * Billing Frequencies 
  156. */ 
  157. define( 'WP_FS__PERIOD_ANNUALLY', 'annual' ); 
  158. define( 'WP_FS__PERIOD_MONTHLY', 'monthly' ); 
  159. define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' ); 
  160.  
  161. /** 
  162. * Plans 
  163. */ 
  164. define( 'WP_FS__PLAN_DEFAULT_PAID', false ); 
  165. define( 'WP_FS__PLAN_FREE', 'free' ); 
  166. define( 'WP_FS__PLAN_TRIAL', 'trial' ); 
  167.  
  168. /** 
  169. * Times in seconds 
  170. */ 
  171. define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 ); 
  172. define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 ); 
  173. // define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 ); 
  174. define( 'WP_FS__TIME_24_HOURS_IN_SEC', 86400 ); 
  175.  
  176. /** 
  177. * Debugging 
  178. */ 
  179. if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) { 
  180. $debug_mode = get_option( 'fs_debug_mode', null ); 
  181.  
  182. if ( $debug_mode === null ) { 
  183. $debug_mode = false; 
  184. add_option( 'fs_debug_mode', $debug_mode ); 
  185.  
  186. define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE ); 
  187.  
  188. define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) ); 
  189. define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-n-d H:i:s' ); 
  190. if ( ! defined( 'FS_API__LOGGER_ON' ) ) { 
  191. define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK ); 
  192.  
  193. if ( WP_FS__ECHO_DEBUG_SDK ) { 
  194. error_reporting( E_ALL ); 
  195. ini_set( 'error_reporting', E_ALL ); 
  196. ini_set( 'display_errors', true ); 
  197. ini_set( 'html_errors', true ); 
  198.  
  199.  
  200. define( 'WP_FS__SCRIPT_START_TIME', time() ); 
  201. define( 'WP_FS__DEFAULT_PRIORITY', 10 ); 
  202. define( 'WP_FS__LOWEST_PRIORITY', 999999999 ); 
.