Plugin Directory

Changeset 2415019


Ignore:
Timestamp:
11/09/2020 08:35:50 AM (5 years ago)
Author:
crmthrive
Message:

1.7 11092020 Update new extend plugins

Location:
crm-thrive
Files:
30 added
5 edited

Legend:

Unmodified
Added
Removed
  • crm-thrive/trunk/admin/class-wsl-admin.php

    r2328704 r2415019  
    8080            'wsl_section' // Section           
    8181        );
     82       
     83        if(in_array('typeform/index.php', apply_filters('active_plugins', get_option('active_plugins')))){
     84            add_settings_field(
     85                'typeform_api_key', // ID
     86                'TypeForm Access Token', // Title
     87                array( $this, 'get_typeform_token' ), // Callback
     88                'wsl-setting-admin', // Page
     89                'wsl_section' // Section           
     90            );
     91        }
    8292    }
    8393   
     
    124134        include_once WSL_ADMIN_DIR.'/partials/send_to_company_field.php';
    125135    }
     136
     137    public function get_typeform_token(){
     138        printf(
     139            '<input type="text" id="typeform_api_key" name="wsl_settings[typeform_api_key]" class="regular-text" value="%s" />',
     140            isset( $this->options['typeform_api_key'] ) ? esc_attr( $this->options['typeform_api_key']) : ''
     141        );
     142    }
    126143   
    127144}
  • crm-thrive/trunk/crm-thrive.php

    r2396628 r2415019  
    55 * Plugin URI: https://www.crmthrive.com/
    66 * Description: Save the leads to Thrive system generated by various form plugins. We currently support CF7, Ninja Forms, WP Forms, Gravity Forms and Elementor Builder.
    7  * Version: 1.6
     7 * Version: 1.7
    88 * Author: Thrive
    99 * Author URI: https://profiles.wordpress.org/crmthrive/
     
    4242require_once WSL_INCLUDES_DIR . '/class-wsl-divi-api.php';
    4343require_once WSL_INCLUDES_DIR . '/class-wsl-wpff-api.php';
     44require_once WSL_INCLUDES_DIR . '/class-wsl-wpformidable-api.php';
     45require_once WSL_INCLUDES_DIR . '/class-wsl-typeform-api.php';
     46require_once WSL_INCLUDES_DIR . '/class-wsl-beaver-api.php';
     47require_once WSL_INCLUDES_DIR . '/class-wsl-wpbrizy-api.php';
    4448
    4549if(is_admin()){
     
    144148
    145149function wsl_divi(){
    146     $laravel_api = new Wsl_Divi_Api($_POST["et_pb_contact_email_fields_0"]);
    147     $laravel_api->set_submission_instance($_POST["et_pb_contact_email_fields_0"]);
     150    reset($_POST);
     151    $key = key($_POST);
     152    $counter = substr($key, -1);
     153    $laravel_api = new Wsl_Divi_Api($_POST["et_pb_contact_email_fields_".$counter]);
     154    $laravel_api->set_submission_instance($_POST["et_pb_contact_email_fields_".$counter]);
    148155    $laravel_api->call();
    149156}
     
    157164    $laravel_api->call();
    158165}
     166
     167add_action("wp_ajax_nopriv_wsl_typeform", "wsl_typeform");
     168add_action("wp_ajax_wsl_typeform", "wsl_typeform");
     169
     170function wsl_typeform() {
     171    $fields = typeform_api($_POST['response_id']);
     172   
     173    $laravel_api = new Wsl_Typeform_Api($fields);
     174    $laravel_api->set_submission_instance($fields);
     175    $laravel_api->call();
     176}
     177
     178add_action( 'wp_ajax_fl_builder_email', 'wsl_beaver' );
     179add_action("wp_ajax_nopriv_fl_builder_email", "wsl_beaver");
     180
     181function wsl_beaver(){
     182    $laravel_api = new Wsl_Beaver_Api($_POST);
     183    $laravel_api->set_submission_instance($_POST);
     184    $laravel_api->call();
     185}
     186
     187add_action( 'wp_ajax_brizy_submit_form', 'wsl_brizy' );
     188add_action("wp_ajax_nopriv_brizy_submit_form", "wsl_brizy");
     189
     190function wsl_brizy(){
     191    $fields_data = $_POST["data"];
     192   
     193    $laravel_api = new Wsl_Brizy_Api($fields_data);
     194    $laravel_api->set_submission_instance($_POST);
     195    $laravel_api->call();
     196}
  • crm-thrive/trunk/includes/class-wsl-divi-api.php

    r2396628 r2415019  
    196196                break;
    197197            }
    198             if(strpos(strtolower($field['label']), 'address') !== false){
     198            if(strtolower($field['label']) == 'address'){
    199199                $value['address'] = $field['value'];
    200200                $this->unset_additional_data($field['key']);
  • crm-thrive/trunk/includes/helpers.php

    r2238078 r2415019  
    11<?php
     2function is_send_to_crm(){
     3    return wsl_get_setting('send_to_crm');
     4}
    25
    36function wsl_get_default_cf7_post_settings(){
     
    6568}
    6669
     70function typeform_script() {
     71    wp_register_script( "my_custom_script", WP_PLUGIN_URL.'/crm-thrive/assets/custom.js', array('jquery') );
     72    wp_localize_script( 'my_custom_script', 'localize', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
     73
     74    wp_enqueue_script( 'jquery' );
     75    wp_enqueue_script( 'my_custom_script' );
     76}
     77add_action( 'plugins_loaded', 'typeform_script' );
     78
     79function typeform_api($response_id){
     80
     81    $get_settings = wsl_get_settings();
     82    $token = $get_settings["typeform_api_key"];
     83
     84    //setup the request, you can also use CURLOPT_URL
     85    $ret_form = curl_init('https://api.typeform.com/forms');
     86    sleep(30);
     87    curl_setopt($ret_form, CURLOPT_RETURNTRANSFER, true);
     88    curl_setopt($ret_form, CURLOPT_HTTPHEADER, array(
     89        'Content-Type: application/json',
     90        'Authorization: Bearer ' . $token
     91    ));
     92    $data_form = curl_exec($ret_form);
     93    $strip = stripslashes($data_form);
     94    $decode_obj = json_decode($strip, true);
     95    foreach($decode_obj["items"] as $key=>$v){
     96        $ch = curl_init('https://api.typeform.com/forms/'.$v["id"].'/responses?included_response_ids='.$response_id);
     97        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     98        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     99            'Content-Type: application/json',
     100            'Authorization: Bearer ' . $token
     101        ));
     102
     103        $data = curl_exec($ch);
     104        $strip_data = stripslashes($data);
     105        $decode_obj_data = json_decode($strip_data, true);
     106        if($decode_obj_data["total_items"] > 0){
     107            $data_items = $decode_obj_data["items"];
     108            return $data_items;
     109        }else{
     110            return 'Response: false';
     111        }
     112
     113        $info = curl_getinfo($ch);
     114        curl_close($ch);
     115    }
     116
     117    $info_form = curl_getinfo($ret_form);
     118    curl_close($ret_form);
     119}
     120
  • crm-thrive/trunk/readme.txt

    r2396628 r2415019  
    44Requires at least: 2.0
    55Tested up to: 5.3.2
    6 Stable tag: 1.6
    7 Requires PHP: 5.2.4
     6Stable tag: 1.7
     7Requires PHP: 5.5.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 Form submissions instantly available in Thrive. We currently support CF7, Ninja Forms, WP Forms, Gravity Forms and Elementor Builder. More coming soon. For more information on features, plans and more check out [crmthrive.com](https://www.crmthrive.com/).
     15Form submissions instantly available in Thrive. We currently support CF7, Ninja Forms, WP Forms, Gravity Forms and Elementor Builder, DIVI, Fluent Forms, Beaver Builder, TypeForms, Brizy Builder. More coming soon. For more information on features, plans and more check out [crmthrive.com](https://www.crmthrive.com/).
    1616
    1717== Installation ==
     
    4949= 1.6 =
    5050* Added fluent forms support
     51
     52= 1.7 =
     53* Added TypeForms support
     54* Added Beaver Builder support
     55* Added Brizy Builder support
Note: See TracChangeset for help on using the changeset viewer.