combine() 공개 메소드

public combine ( $methods ) : array
$methods
리턴 array
 /**
  * Process form submissions
  *
  * @return bool|string
  */
 public function process()
 {
     if (!$this->triggered()) {
         return false;
     }
     /**
      * @var Ninja_Forms_Processing $ninja_forms_processing
      */
     global $ninja_forms_processing;
     // generate an array of field label => field value
     $fields = $ninja_forms_processing->get_all_submitted_fields();
     $pretty = array();
     foreach ($fields as $field_id => $field_value) {
         // try admin label for "mc4wp-" prefixed fields, otherwise use general label
         $label = $ninja_forms_processing->get_field_setting($field_id, 'admin_label');
         if (empty($label) || stripos($label, 'mc4wp-') !== 0) {
             $label = $ninja_forms_processing->get_field_setting($field_id, 'label');
         }
         $pretty[$label] = $field_value;
     }
     // guess mailchimp variables
     $parser = new MC4WP_Field_Guesser($pretty);
     $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, $ninja_forms_processing->get_form_ID());
 }
예제 #2
0
 /**
  * Process custom form
  *
  * @return bool|string
  */
 public function process()
 {
     $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);
 }
 /**
  * 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());
 }
예제 #4
0
 /**
  * Process form submissions
  *
  * @return bool|string
  */
 public function process()
 {
     if (!$this->triggered()) {
         return false;
     }
     /**
      * @var Ninja_Forms_Processing $ninja_forms_processing
      */
     global $ninja_forms_processing;
     $fields = $ninja_forms_processing->get_all_submitted_fields();
     // TODO: Allow for more fields here, NF uses id's which are not very helpful for our Field Guesser
     // guess mailchimp variables
     $parser = new MC4WP_Field_Guesser($fields);
     $data = $parser->combine(array('guessed', 'namespaced'));
     // do nothing if no email was found
     if (empty($data['EMAIL'])) {
         return false;
     }
     // TODO: Pass Ninja Forms ID here
     return $this->subscribe($data['EMAIL'], $data);
 }