Changeset 2512925
- Timestamp:
- 04/11/2021 05:23:31 PM (5 years ago)
- Location:
- powers-triggers-of-woo-to-chat/trunk
- Files:
-
- 5 edited
-
class-wwp-woocommerce-front.php (modified) (4 diffs)
-
include/class-wwp-whatsapp.php (modified) (1 diff)
-
include/class-wwp-woocommerce.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
wc-whatsapp-powers.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
powers-triggers-of-woo-to-chat/trunk/class-wwp-woocommerce-front.php
r2509693 r2512925 12 12 13 13 add_filter( 'wwp_replace_woocommerce_modelo', array($this,'wwp_tracking_filter' ), 10, 2 ); 14 14 if(isset($_GET['wwp_do_reminder'])){ 15 $this->wwp_do_reminder(); 16 exit(); 17 } 15 18 } 16 19 … … 53 56 54 57 public function wwp_do_reminder (){ 55 date_default_timezone_set(get_option('timezone_string' ));58 date_default_timezone_set(get_option('timezone_string','America/Sao_Paulo')); 56 59 $settings = $this->settings; 57 60 $intervalos = $settings->hold_order->intervalo; … … 63 66 'meta_key' => 'wwp_notify_whatsapp', 64 67 'meta_compare' => '==', 65 'meta_value' => 1 68 'meta_value' => 1, 69 'limit' => 999 66 70 )); 67 71 … … 273 277 'payment_url' => isset( $moip->payBoleto->printHref ) ? $moip->payBoleto->printHref : $defaults['payment_url'] 274 278 ); 275 } elseif ( 'paghiper' === $order->get_payment_method()) {279 } elseif ( in_array($order->get_payment_method(), ['paghiper', 'paghiper_billet', 'paghiper_pix'])) { 276 280 $paghiper = get_post_meta( $order->get_id(), 'wc_paghiper_data', true ); 277 281 $paghiper = maybe_unserialize( $paghiper ); 278 $args = array( 279 'payment_url' => isset( $paghiper['url_slip_pdf'] ) ? $paghiper['url_slip_pdf'] : $defaults['payment_url'] 282 $url = isset( $paghiper['url_slip_pdf'] ) ? $paghiper['url_slip_pdf'] : ''; 283 $url = isset( $paghiper['pix_url'] ) ? $paghiper['pix_url'] : ''; 284 $args = array( 285 'payment_url' => $url!='' ? $url : $defaults['payment_url'] 280 286 ); 281 287 } elseif ( 'mundipagg-banking-ticket' === $order->get_payment_method() ) { -
powers-triggers-of-woo-to-chat/trunk/include/class-wwp-whatsapp.php
r2509693 r2512925 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;}} ?>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 clearMessage($message){if(empty($message)){return FALSE;}return preg_replace('/[\{].*?[\}]/','',$message);}public function sendMessage($phone_no='',$message=''){if(empty($phone_no)or empty($message)){return FALSE;}$phone_no=$this->phone_validation($phone_no);$message=$this->clearMessage($message);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/include/class-wwp-woocommerce.php
r2380710 r2512925 15 15 'action' => 'woocommerce_order_status_processing', 16 16 'modelo' => '', 17 ), 17 ), 18 18 'hold_order' => array( 19 19 'ativo' => '', … … 31 31 'modelo' => '', 32 32 ), 33 'completed_order' => array( 34 'ativo' => '', 35 'titulo' => 'O pedido for concluido!', 36 'descricao' => '', 37 'action' => 'woocommerce_order_status_completed', 38 'modelo' => '', 39 ), 33 40 ); 34 41 -
powers-triggers-of-woo-to-chat/trunk/readme.txt
r2509693 r2512925 54 54 55 55 == Changelog == 56 * 1.6.2 57 * Novo status para gatilho de pedido no woocommerce 56 58 * 1.6.1 57 * Correções de bugs 59 * Correções de bugs e novo status para gatilho de woocommerce 58 60 * 1.6.0 59 61 * 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
r2509693 r2512925 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. 16 * Version: 1.6.2 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.