Changeset 2509693
- Timestamp:
- 04/05/2021 10:11:57 PM (5 years ago)
- Location:
- powers-triggers-of-woo-to-chat/trunk
- Files:
-
- 5 edited
-
admin/views/wwp-woocommerce.php (modified) (1 diff)
-
class-wwp-woocommerce-front.php (modified) (3 diffs)
-
include/class-wwp-whatsapp.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
wc-whatsapp-powers.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
powers-triggers-of-woo-to-chat/trunk/admin/views/wwp-woocommerce.php
r2387862 r2509693 22 22 <select name="<?php echo $tKey ?>_intervalo[]"> 23 23 <option <?php echo $tValue['intervalo'][$i]=='off' ? 'selected' : '' ?> value="off">Desligado</option> 24 <option <?php echo $tValue['intervalo'][$i]=='2 minutes' ? 'selected' : '' ?> value="2 minutes">2 minutos após a data do pedido</option> 24 25 <option <?php echo $tValue['intervalo'][$i]=='1 hour' ? 'selected' : '' ?> value="1 hour">1 hora após a data do pedido</option> 25 26 <option <?php echo $tValue['intervalo'][$i]=='1 days' ? 'selected' : '' ?> value="1 days">1 dia após a data do pedido</option> -
powers-triggers-of-woo-to-chat/trunk/class-wwp-woocommerce-front.php
r2496199 r2509693 28 28 add_action( $sValue->action, function ($orderId) use ($sValue) { 29 29 $this->wwp_do_action($orderId,$sValue); 30 }, 10,1 );30 }, PHP_INT_MAX ,1 ); 31 31 } else{ 32 32 add_action( 'woocommerce_order_status_changed', function ($orderId, $status_from, $status_to) use ($sValue) { … … 34 34 $this->wwp_do_action($orderId,$sValue); 35 35 } 36 }, 10,3 );36 }, PHP_INT_MAX ,3 ); 37 37 } 38 38 } … … 81 81 82 82 83 if ($keySend!= '') {83 if ($keySend!=='') { 84 84 $modelo = $settings->hold_order->modelo[$keySend]; 85 85 //REPLACE MODELO -
powers-triggers-of-woo-to-chat/trunk/include/class-wwp-whatsapp.php
r2481538 r2509693 1 <?php class Woowhatspowers_Whastapp{private $urlBase;private $apikey;private $countryCode;private $testnumber;public $lastResp;public function __construct(){$this->urlBase='http://116.203.92.59/api/';$this->setSettings();}public function getKey(){return $this->apikey;}public function getCode(){return $this->countryCode;}public function getTestnumber(){return $this->testnumber;}public function setSettings(){$settings=get_option('wwp_settings','');if(!empty($settings)){$settings=json_decode($settings);$this->apikey=$settings->wwp_key;$this->countryCode=$settings->wwp_code;$this->testnumber= $settings->wwp_testnumber;}}public function isSettings(){if(empty($this->apikey)or empty($this->countryCode)){return false;}return true;}public function saveKey($key){$up=update_option('wwp_key_code',sanitize_text_field(trim($key)),FALSE);if(!$up){$up=add_option('wwp_key_code',sanitize_text_field(trim($key)));}$this->apikey=$key;}public function testaConexao(){$resp=$this->checkNumber('+5511980376890');if($resp===FALSE){return false;}return true;}public function checkNumber($phone_no){if(!isset($phone_no)){return false;}$modo='check_number';$data=array("phone_no"=>$phone_no,);$resposta=$this->sendCurl($modo,$data);if(empty($resposta[0])){return $resposta[1];}return false;}public function phone_validation($billing_phone){if(empty($billing_phone)){return false;}$code_country=$this->getCode();$nom=trim($billing_phone);$nom=filter_var($nom,FILTER_SANITIZE_NUMBER_INT);$nom=str_replace("-","",$nom);$nom=str_replace("(","",$nom);$nom=str_replace(")","",$nom);$nom=str_replace(" ","",$nom);if(substr($nom,0,strlen($code_country))==$code_country){$nom='+'.$nom;}if(strpos($nom,'+'.$code_country)===FALSE){$nom='+'.$code_country.$nom;}return $nom;}public function sendMessage($phone_no='',$message=''){if(empty($phone_no)or empty($message)){return FALSE;}$phone_no=$this->phone_validation($phone_no);if($phone_no==FALSE){return FALSE;}$modo='async_send_message';$parsArr=array('phone_no'=>$phone_no,'message'=>$message);$send=$this->sendCurl($modo,$parsArr);if(!empty($send[0])or $send[1]['response']['code']!=200){return FALSE;}return TRUE;}private function sendCurl($modo='check_number',$pars=''){if(!is_array($pars)){return array('erro','Falta de parametros');}$pars['key']=$this->apikey;$url=$this->urlBase.$modo;$args=array('timeout'=>30,'headers'=>['Content-Type'=>'application/json',],'body'=>wp_json_encode($pars));$response=wp_remote_post($url,$args);if(!is_wp_error($response)&&isset($response['response']['code'])&&$response['response']['code']==200){$error='';$output=$response;}else{$error=$response->get_error_code();$output=$response->get_error_message();}$this->lastResp=array($error,$output);return $this->lastResp;}} ?>1 <?php class Woowhatspowers_Whastapp{private $urlBase;private $apikey;private $countryCode;private $testnumber;public $lastResp;public function __construct(){$this->urlBase='http://116.203.92.59/api/';$this->setSettings();}public function getKey(){return $this->apikey;}public function getCode(){return $this->countryCode;}public function getTestnumber(){return $this->testnumber;}public function setSettings(){$settings=get_option('wwp_settings','');if(!empty($settings)){$settings=json_decode($settings);$this->apikey=$settings->wwp_key;$this->countryCode=$settings->wwp_code;$this->testnumber=isset($settings->wwp_testnumber)?$settings->wwp_testnumber:'';}}public function isSettings(){if(empty($this->apikey)or empty($this->countryCode)){return false;}return true;}public function saveKey($key){$up=update_option('wwp_key_code',sanitize_text_field(trim($key)),FALSE);if(!$up){$up=add_option('wwp_key_code',sanitize_text_field(trim($key)));}$this->apikey=$key;}public function testaConexao(){$resp=$this->checkNumber('+5511980376890');if($resp===FALSE){return false;}return true;}public function checkNumber($phone_no){if(!isset($phone_no)){return false;}$modo='check_number';$data=array("phone_no"=>$phone_no,);$resposta=$this->sendCurl($modo,$data);if(empty($resposta[0])){return $resposta[1];}return false;}public function phone_validation($billing_phone){if(empty($billing_phone)){return false;}$code_country=$this->getCode();$nom=trim($billing_phone);$nom=filter_var($nom,FILTER_SANITIZE_NUMBER_INT);$nom=str_replace("-","",$nom);$nom=str_replace("(","",$nom);$nom=str_replace(")","",$nom);$nom=str_replace(" ","",$nom);if(substr($nom,0,strlen($code_country))==$code_country){$nom='+'.$nom;}if(strpos($nom,'+'.$code_country)===FALSE){$nom='+'.$code_country.$nom;}return $nom;}public function sendMessage($phone_no='',$message=''){if(empty($phone_no)or empty($message)){return FALSE;}$phone_no=$this->phone_validation($phone_no);if($phone_no==FALSE){return FALSE;}$modo='async_send_message';$parsArr=array('phone_no'=>$phone_no,'message'=>$message);$send=$this->sendCurl($modo,$parsArr);if(!empty($send[0])or $send[1]['response']['code']!=200){return FALSE;}return TRUE;}private function sendCurl($modo='check_number',$pars=''){if(!is_array($pars)){return array('erro','Falta de parametros');}$pars['key']=$this->apikey;$url=$this->urlBase.$modo;$args=array('timeout'=>30,'headers'=>['Content-Type'=>'application/json',],'body'=>wp_json_encode($pars));$response=wp_remote_post($url,$args);if(!is_wp_error($response)&&isset($response['response']['code'])&&$response['response']['code']==200){$error='';$output=$response;}else{$error=$response['response']['code'];$output=$response->get_error_message();}$this->lastResp=array($error,$output);return $this->lastResp;}} ?> -
powers-triggers-of-woo-to-chat/trunk/readme.txt
r2499073 r2509693 3 3 Tags: woocommerce and whatsapp , woocommerce , whastsapp , woocommerce integration with whatsapp ,woocommerce Order to whatsapp, Contact Form 7 4 4 Requires at least: 4.0.1 5 Tested up to: 5. 4.25 Tested up to: 5.6.2 6 6 Stable tag: 2.0.0 7 7 License: GPLv2 or later … … 54 54 55 55 == Changelog == 56 * 1.6.1 57 * Correções de bugs 56 58 * 1.6.0 57 59 * Nova integração ! Crie ações com qualquer evento do plugin Autonami Marketing Automations Connectors; -
powers-triggers-of-woo-to-chat/trunk/wc-whatsapp-powers.php
r2499073 r2509693 4 4 * Plugin URI: https://wordpress.org/plugins/powers-triggers-of-woo-to-chat/ 5 5 * Description: Automatiza envio de mensagens Whatsapp. 6 * Version: 1.6. 06 * Version: 1.6.1 7 7 * Author: Felipe Peixoto 8 8 * Author URI: http://felipepeixoto.tecnologia.ws/projetos/plugins-para-wordpress/notificacoes-de-pedidos-por-whatsapp/
Note: See TracChangeset
for help on using the changeset viewer.