/settings.php

  1. <?php 
  2.  
  3. require_once WPCF7_PLUGIN_DIR . '/includes/functions.php'; 
  4. require_once WPCF7_PLUGIN_DIR . '/includes/l10n.php'; 
  5. require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php'; 
  6. require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php'; 
  7. require_once WPCF7_PLUGIN_DIR . '/includes/form-tag.php'; 
  8. require_once WPCF7_PLUGIN_DIR . '/includes/form-tags-manager.php'; 
  9. require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php'; 
  10. require_once WPCF7_PLUGIN_DIR . '/includes/capabilities.php'; 
  11. require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-template.php'; 
  12. require_once WPCF7_PLUGIN_DIR . '/includes/contact-form.php'; 
  13. require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-functions.php'; 
  14. require_once WPCF7_PLUGIN_DIR . '/includes/mail.php'; 
  15. require_once WPCF7_PLUGIN_DIR . '/includes/submission.php'; 
  16. require_once WPCF7_PLUGIN_DIR . '/includes/upgrade.php'; 
  17. require_once WPCF7_PLUGIN_DIR . '/includes/integration.php'; 
  18. require_once WPCF7_PLUGIN_DIR . '/includes/config-validator.php'; 
  19. require_once WPCF7_PLUGIN_DIR . '/includes/rest-api.php'; 
  20.  
  21. if ( is_admin() ) { 
  22. require_once WPCF7_PLUGIN_DIR . '/admin/admin.php'; 
  23. } else { 
  24. require_once WPCF7_PLUGIN_DIR . '/includes/controller.php'; 
  25.  
  26. class WPCF7 { 
  27.  
  28. public static function load_modules() { 
  29. self::load_module( 'acceptance' ); 
  30. self::load_module( 'akismet' ); 
  31. self::load_module( 'checkbox' ); 
  32. self::load_module( 'count' ); 
  33. self::load_module( 'date' ); 
  34. self::load_module( 'file' ); 
  35. self::load_module( 'flamingo' ); 
  36. self::load_module( 'listo' ); 
  37. self::load_module( 'number' ); 
  38. self::load_module( 'quiz' ); 
  39. self::load_module( 'really-simple-captcha' ); 
  40. self::load_module( 'recaptcha' ); 
  41. self::load_module( 'response' ); 
  42. self::load_module( 'select' ); 
  43. self::load_module( 'submit' ); 
  44. self::load_module( 'text' ); 
  45. self::load_module( 'textarea' ); 
  46. self::load_module( 'hidden' ); 
  47.  
  48. protected static function load_module( $mod ) { 
  49. $dir = WPCF7_PLUGIN_MODULES_DIR; 
  50.  
  51. if ( empty( $dir ) || ! is_dir( $dir ) ) { 
  52. return false; 
  53.  
  54. $file = path_join( $dir, $mod . '.php' ); 
  55.  
  56. if ( file_exists( $file ) ) { 
  57. include_once $file; 
  58.  
  59. public static function get_option( $name, $default = false ) { 
  60. $option = get_option( 'wpcf7' ); 
  61.  
  62. if ( false === $option ) { 
  63. return $default; 
  64.  
  65. if ( isset( $option[$name] ) ) { 
  66. return $option[$name]; 
  67. } else { 
  68. return $default; 
  69.  
  70. public static function update_option( $name, $value ) { 
  71. $option = get_option( 'wpcf7' ); 
  72. $option = ( false === $option ) ? array() : (array) $option; 
  73. $option = array_merge( $option, array( $name => $value ) ); 
  74. update_option( 'wpcf7', $option ); 
  75.  
  76. add_action( 'plugins_loaded', 'wpcf7' ); 
  77.  
  78. function wpcf7() { 
  79. wpcf7_load_textdomain(); 
  80. WPCF7::load_modules(); 
  81.  
  82. /** Shortcodes */ 
  83. add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' ); 
  84. add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' ); 
  85.  
  86. add_action( 'init', 'wpcf7_init' ); 
  87.  
  88. function wpcf7_init() { 
  89. wpcf7_get_request_uri(); 
  90. wpcf7_register_post_types(); 
  91.  
  92. do_action( 'wpcf7_init' ); 
  93.  
  94. add_action( 'admin_init', 'wpcf7_upgrade' ); 
  95.  
  96. function wpcf7_upgrade() { 
  97. $old_ver = WPCF7::get_option( 'version', '0' ); 
  98. $new_ver = WPCF7_VERSION; 
  99.  
  100. if ( $old_ver == $new_ver ) { 
  101. return; 
  102.  
  103. do_action( 'wpcf7_upgrade', $new_ver, $old_ver ); 
  104.  
  105. WPCF7::update_option( 'version', $new_ver ); 
  106.  
  107. /** Install and default settings */ 
  108.  
  109. add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' ); 
  110.  
  111. function wpcf7_install() { 
  112. if ( $opt = get_option( 'wpcf7' ) ) { 
  113. return; 
  114.  
  115. wpcf7_load_textdomain(); 
  116. wpcf7_register_post_types(); 
  117. wpcf7_upgrade(); 
  118.  
  119. if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) ) { 
  120. return; 
  121.  
  122. $contact_form = WPCF7_ContactForm::get_template( 
  123. array( 
  124. 'title' => sprintf( __( 'Contact form %d', 'contact-form-7' ), 1 ),  
  125. ); 
  126.  
  127. $contact_form->save(); 
  128.  
  129. WPCF7::update_option( 'bulk_validate',  
  130. array( 
  131. 'timestamp' => current_time( 'timestamp' ),  
  132. 'version' => WPCF7_VERSION,  
  133. 'count_valid' => 1,  
  134. 'count_invalid' => 0,  
  135. ); 
.