Changeset 2600478
- Timestamp:
- 09/17/2021 11:15:11 AM (5 years ago)
- Location:
- lead-generated
- Files:
-
- 29 added
- 5 edited
-
tags/1.18 (added)
-
tags/1.18/admin (added)
-
tags/1.18/admin/class-wsl-admin.php (added)
-
tags/1.18/admin/editor-panel.php (added)
-
tags/1.18/admin/partials (added)
-
tags/1.18/admin/partials/send_to_company_field.php (added)
-
tags/1.18/helpers.php (added)
-
tags/1.18/includes (added)
-
tags/1.18/includes/assets (added)
-
tags/1.18/includes/assets/custom.js (added)
-
tags/1.18/includes/class-wsl-api.php (added)
-
tags/1.18/includes/class-wsl-beaver-api.php (added)
-
tags/1.18/includes/class-wsl-caldera-api.php (added)
-
tags/1.18/includes/class-wsl-cf7-api.php (added)
-
tags/1.18/includes/class-wsl-divi-api.php (added)
-
tags/1.18/includes/class-wsl-elementor-api.php (added)
-
tags/1.18/includes/class-wsl-formidable-api.php (added)
-
tags/1.18/includes/class-wsl-gravity-api.php (added)
-
tags/1.18/includes/class-wsl-ninja-api.php (added)
-
tags/1.18/includes/class-wsl-smartforms-api.php (added)
-
tags/1.18/includes/class-wsl-thriveform-api.php (added)
-
tags/1.18/includes/class-wsl-typeform-api.php (added)
-
tags/1.18/includes/class-wsl-wpbrizy-api.php (added)
-
tags/1.18/includes/class-wsl-wpf-api.php (added)
-
tags/1.18/includes/class-wsl-wpff-api.php (added)
-
tags/1.18/includes/helpers.php (added)
-
tags/1.18/includes/wsl-base.php (added)
-
tags/1.18/lead-generated.php (added)
-
tags/1.18/readme.txt (added)
-
trunk/includes/class-wsl-api.php (modified) (1 diff)
-
trunk/includes/class-wsl-typeform-api.php (modified) (2 diffs)
-
trunk/includes/helpers.php (modified) (4 diffs)
-
trunk/lead-generated.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lead-generated/trunk/includes/class-wsl-api.php
r2286317 r2600478 93 93 } 94 94 95 public function callTypeFormAuth($url, $authorization, $method = 'POST'){ 96 $headers = array(); 97 $headers['Accept'] = "application/json"; 98 $headers['Content-Type'] = "application/json"; 99 $headers['Authorization'] = $authorization; 100 101 $args = array( 102 'headers' => $headers, 103 'timeout' => '30', 104 'redirection' => '5', 105 'httpversion' => '1.0', 106 'blocking' => true, 107 ); 108 109 if($method == 'GET'){ 110 $response = wp_remote_get( $url, $args); 111 }elseif($method == 'POST'){ 112 $args['body'] = json_encode($post_data); 113 $response = wp_remote_post( $url, $args ); 114 }else{ 115 $args['method'] = $method; 116 $response = wp_remote_request( $url, $args ); 117 } 118 119 $body = wp_remote_retrieve_body( $response ); 120 return json_decode($body); 121 } 122 95 123 } 96 124 -
lead-generated/trunk/includes/class-wsl-typeform-api.php
r2415131 r2600478 256 256 foreach($formData[0]["answers"] as $k=>$v){ 257 257 if($v["type"] != "email"){ 258 $type = $v["field"]["ref"]; 258 259 $tags = explode('-' , $v["field"]["ref"]); 260 261 if(count($tags) > 4){ 262 $type = $v["type"]; 263 }else{ 264 $type = $v["field"]["ref"]; 265 } 259 266 }else{ 260 267 $type = $v["type"]; … … 268 275 ); 269 276 } 270 271 277 return $fields; 272 278 } -
lead-generated/trunk/includes/helpers.php
r2415582 r2600478 18 18 function wsl_get_cf7_post_settings($post_id){ 19 19 $meta = get_post_meta($post_id,'_wsl_settings',TRUE); 20 //var_dump($meta); 20 21 if(!is_array($meta)){ 21 22 return wsl_get_default_cf7_post_settings(); … … 69 70 70 71 function typeform_script() { 71 wp_register_script( "my_custom_script", plugin_dir_url( __FILE__ ).'assets/custom.js', array('jquery') );72 wp_register_script( "my_custom_script", plugin_dir_url( __FILE__ ).'assets/custom.js', array('jquery'), NULL, TRUE ); 72 73 wp_localize_script( 'my_custom_script', 'localize', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ))); 73 74 … … 75 76 wp_enqueue_script( 'my_custom_script' ); 76 77 } 77 add_action( ' admin_enqueue_scripts', 'typeform_script' );78 add_action( 'wp_enqueue_scripts', 'typeform_script' ); 78 79 79 80 function typeform_api($response_id){ … … 82 83 $token = $get_settings["typeform_api_key"]; 83 84 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 )); 85 $api_obj = new Wsl_Api(); 86 $call_init = $api_obj->callTypeFormAuth('https://api.typeform.com/forms', 'Bearer ' . $token, $method = 'GET'); 102 87 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"]; 88 $getItems = json_decode(json_encode($call_init), true); 89 90 foreach($getItems["items"] as $key=>$v){ 91 $ch = $api_obj->callTypeFormAuth('https://api.typeform.com/forms/'.$v["id"].'/responses?included_response_ids='.$response_id, 'Bearer ' . $token, $method = 'GET'); 92 $totalItems = json_decode(json_encode($ch), true); 93 if($totalItems["total_items"] > 0){ 94 $data_items = $totalItems["items"]; 108 95 return $data_items; 109 96 }else{ 110 97 return 'Response: false'; 111 98 } 112 113 $info = curl_getinfo($ch);114 curl_close($ch);115 99 } 116 117 $info_form = curl_getinfo($ret_form);118 curl_close($ret_form);119 100 } 120 101 -
lead-generated/trunk/lead-generated.php
r2600388 r2600478 5 5 * Plugin URI: https://www.leadgenerated.com/ 6 6 * Description: Save the leads to Lead Generated system generated by various form plugins. We currently support CF7, Ninja Forms, WP Forms, Gravity Forms and Elementor Builder. 7 * Version: 1.1 77 * Version: 1.18 8 8 * Author: Lead Generated 9 9 * Author URI: https://profiles.wordpress.org/leadgenerated/ -
lead-generated/trunk/readme.txt
r2600388 r2600478 4 4 Requires at least: 2.0 5 5 Tested up to: 5.6 6 Stable tag: 1.1 76 Stable tag: 1.18 7 7 Requires PHP: 5.2.4 8 8 License: GPLv2 or later … … 87 87 = 1.17 = 88 88 * Fluent Form Fixes 89 90 = 1.18 = 91 * Typeform Fixes
Note: See TracChangeset
for help on using the changeset viewer.