/**
  * Subscribe from Contact Form 7 Forms
  *
  * @todo improve smart guessing based on selected MailChimp lists
  *
  * @param WPCF7_ContactForm $cf7_form
  * @return bool
  */
 public function process($cf7_form)
 {
     // was sign-up checkbox checked?
     if (!$this->checkbox_was_checked()) {
         return false;
     }
     $parser = new MC4WP_Field_Guesser($this->get_data());
     $data = $parser->combine(array('guessed', 'namespaced'));
     // do nothing if no email was found
     if (empty($data['EMAIL'])) {
         return false;
     }
     return $this->subscribe($data['EMAIL'], $data, $cf7_form->id());
 }
Esempio n. 2
0
 public function __construct(WPCF7_ContactForm $contact_form)
 {
     $this->contact_form = $contact_form;
     $config_errors = get_post_meta($contact_form->id(), '_config_errors', true);
     foreach ((array) $config_errors as $section => $errors) {
         if (empty($errors)) {
             continue;
         }
         if (!is_array($errors)) {
             // for back-compat
             $code = $errors;
             $this->add_error($section, $code);
         } else {
             foreach ((array) $errors as $error) {
                 if (!empty($error['code'])) {
                     $code = $error['code'];
                     $args = isset($error['args']) ? $error['args'] : '';
                     $this->add_error($section, $code, $args);
                 }
             }
         }
     }
 }
 /**
  * PHPDOC
  *
  * @param WPCF7_ContactForm $form   PHPDOC
  * @param array             $result PHPDOC
  *
  * @return void
  *
  * @since PHPDOC
  */
 public function track_cf7_submission($form, $result)
 {
     $status = $result['status'];
     $type = NelioABAction::SUBMIT_CF7_FORM;
     if ($status == 'mail_sent' || $status == 'demo_mode') {
         $this->send_form_action_if_required($type, $form->id());
     }
 }