CFDBIntegrationEnfoldTheme

"Contact Form to Database" Copyright (C) 2011-2015 Michael Simpson (email : michael.d.simpson@gmail.com).

Defined (1)

The class is defined in the following location(s).

/CFDBIntegrationEnfoldTheme.php  
  1. class CFDBIntegrationEnfoldTheme { 
  2. /** 
  3. * @var CF7DBPlugin 
  4. */ 
  5. var $plugin; 
  6.  
  7. /** 
  8. * @param $plugin CF7DBPlugin 
  9. */ 
  10. function __construct($plugin) { 
  11. $this->plugin = $plugin; 
  12.  
  13. public function registerHooks() { 
  14. add_filter('avf_form_send', array(&$this, 'saveFormData'), 10, 3); 
  15.  
  16. public function saveFormData($bool, $new_post, $form_params) { 
  17.  
  18. // $msg = '$new_post=' . print_r($new_post, true) . "\n" . 
  19. // '$form_params=' . print_r($form_params, true); 
  20. // $this->plugin->getErrorLog()->log($msg); 
  21.  
  22. try { 
  23. if (is_array($new_post)) { 
  24. $postedData = array(); 
  25. foreach ($new_post as $key => $value) { 
  26. $postedData[$key] = urldecode($value); 
  27.  
  28. $title = 'Enfold'; 
  29. if (is_array($form_params) && 
  30. isset($form_params['heading']) && 
  31. $form_params['heading'] 
  32. ) { 
  33. $title = strip_tags($form_params['heading']); 
  34.  
  35. $data = (object)array( 
  36. 'title' => $title,  
  37. 'posted_data' => $postedData,  
  38. 'uploaded_files' => array()); 
  39. $this->plugin->saveFormData($data); 
  40.  
  41. } catch (Exception $ex) { 
  42. $this->plugin->getErrorLog()->logException($ex); 
  43.  
  44. return true; 
  45.