Exemplo n.º 1
0
 /**
  * Tracker action handler
  *
  * @since 1.0.0
  */
 public function handle_track($prefix, $track_id, $type, $value = null)
 {
     global $formworks_tracker;
     switch ($type) {
         case 'loaded':
             $this->set_tracking($prefix, $track_id, $value);
             break;
         case 'submission':
             $formworks_tracker[] = $track_id;
             tracker::add_submission($prefix, $track_id);
             break;
         case 'partial':
             tracker::add_partial($prefix, $track_id, $value);
             break;
         default:
             tracker::add_notch($prefix, $track_id, $type);
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Get all forms running on the site
  *
  * @since 1.0.0
  *
  * @param $form_list
  *
  * @return mixed
  */
 public function get_forms($form_list)
 {
     if (class_exists('Caldera_Forms')) {
         $forms = \Caldera_Forms::get_forms();
         $form_list['caldera'] = array('name' => __('Caldera Forms', 'caldera-forms'), 'activity' => tracker::get_activity('caldera', 6), 'forms' => array());
         foreach ($forms as $form) {
             $form_list['caldera']['forms'][$form['ID']] = $form['name'];
         }
     }
     if (class_exists('RGFormsModel')) {
         $forms = \RGFormsModel::get_forms(null, 'title');
         $form_list['gform'] = array('name' => __('Gravity Forms', 'gravityforms'), 'activity' => tracker::get_activity('gform', 6), 'forms' => array());
         foreach ($forms as $form) {
             $form_list['gform']['forms'][$form->id] = $form->title;
         }
     }
     if (class_exists('NF_Forms')) {
         $nforms = new \NF_Forms();
         $nforms = $nforms->get_all();
         $form_list['ninja'] = array('name' => __('Ninja Forms', 'ninja-forms'), 'forms' => array());
         foreach ($nforms as $form) {
             $form_list['ninja']['forms'][$form] = Ninja_Forms()->form($form)->get_setting('form_title');
         }
     }
     if (class_exists('WPCF7_ContactForm')) {
         $cforms = \WPCF7_ContactForm::find(array('posts_per_page' => -1));
         $form_list['cf7'] = array('name' => __('Contact Form 7', 'contact-form-7'), 'forms' => array());
         foreach ($cforms as $form) {
             $form_list['cf7']['forms'][$form->id()] = $form->title();
         }
     }
     if (class_exists('FrmForm')) {
         $fforms = \FrmForm::getAll();
         $form_list['frmid'] = array('name' => __('Formidable', 'formidable'), 'forms' => array());
         foreach ($fforms as $form) {
             if (!empty($form->is_template)) {
                 continue;
             }
             $form_list['frmid']['forms'][$form->id] = $form->name;
         }
     }
     // jetpack
     if (function_exists('grunion_display_form_view')) {
         global $wpdb;
         $shortcodes = $wpdb->get_results("SELECT `post_id` FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = '_g_feedback_shortcode';", ARRAY_A);
         if (!empty($shortcodes)) {
             $form_list['jp'] = array('name' => __('Jetpack Contact Form', 'jetpack'), 'forms' => array());
             foreach ($shortcodes as $post_id) {
                 $form = get_post($post_id['post_id']);
                 $form_list['jp']['forms'][$post_id['post_id']] = $form->post_title;
             }
         }
     }
     return $form_list;
 }