Changeset 2582312
- Timestamp:
- 08/12/2021 09:53:15 PM (5 years ago)
- Location:
- powers-triggers-of-woo-to-chat/trunk
- Files:
-
- 6 deleted
- 8 edited
-
admin/class-wwp-admin.php (modified) (4 diffs)
-
admin/js/script.js (modified) (1 diff)
-
admin/views/wwp-campanhas-disparar.php (deleted)
-
admin/views/wwp-campanhas-nova.php (deleted)
-
admin/views/wwp-campanhas-novo-publico.php (deleted)
-
admin/views/wwp-campanhas-table-publico-part.php (deleted)
-
admin/views/wwp-campanhas.php (deleted)
-
admin/views/wwp-woocommerce.php (modified) (2 diffs)
-
class-wwp-woocommerce-front.php (modified) (2 diffs)
-
include/class-wwp-campanha.php (deleted)
-
include/class-wwp-whatsapp.php (modified) (1 diff)
-
include/class-wwp-woocommerce.php (modified) (9 diffs)
-
readme.txt (modified) (1 diff)
-
wc-whatsapp-powers.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
powers-triggers-of-woo-to-chat/trunk/admin/class-wwp-admin.php
r2574786 r2582312 8 8 9 9 $this->whatsapp = new Woowhatspowers_Whastapp; 10 10 11 //ajax 11 12 add_action( 'wp_ajax_wwp_save_settings', array( $this, 'wwp_save_settings' ) ); … … 17 18 add_action( 'wp_ajax_wwp_send_from_cartbounty', array( $this, 'wwp_send_from_cartbounty' ) ); 18 19 19 //ajax Campanha20 add_action( 'wp_ajax_wwp_salvar_campanha', array( $this, 'wwp_salvar_campanha' ) );21 add_action( 'wp_ajax_wwp_salvar_publico', array( $this, 'wwp_salvar_publico' ) );22 add_action( 'wp_ajax_wwp_disparar_campanha', array( $this, 'wwp_disparar_campanha' ) );23 20 24 21 … … 111 108 } 112 109 $triggers = $woo->triggers; 113 110 wp_enqueue_media(); 114 111 wp_enqueue_script( 'wwp-admin-script', plugin_dir_url( __FILE__ ) . 'js/script.js', array('jquery'), rand(0,1000), true ); 115 112 wp_enqueue_style( 'wwp-admin-style', plugin_dir_url( __FILE__ ) . 'css/style.css', '', rand(0,1000), false ); … … 250 247 251 248 252 253 /* Campanhas */254 function wwp_view_woocommerce_campanha () {255 if (!$this->whatsapp->isSettings()) {256 $this->wwp_view_settings();257 return;258 }259 260 wp_enqueue_script( 'wwp-admin-script', plugin_dir_url( __FILE__ ) . 'js/script.js', array('jquery'), rand(0,1000), true );261 wp_enqueue_style( 'wwp-admin-style', plugin_dir_url( __FILE__ ) . 'css/style.css', '', rand(0,1000), false );262 263 wp_enqueue_script( 'wwp-admin-script-modal', plugin_dir_url( __FILE__ ) . 'js/jquery.modal.min.js', array('jquery'), rand(0,1000), true );264 wp_enqueue_style( 'wwp-admin-style-modal', plugin_dir_url( __FILE__ ) . 'css/jquery.modal.min.css', '', rand(0,1000), false );265 266 267 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-campanha.php';268 269 $ca = new Woowhatspowers_Woocommerce_Campanha();270 $campanhas = $ca->getCampanhas();271 272 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-campanhas.php';273 274 }275 276 function wwp_view_nova_campanha () {277 278 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-campanhas-nova.php';279 exit();280 }281 282 function wwp_view_novo_publico () {283 284 $custom_status = wc_get_order_statuses();285 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-campanhas-novo-publico.php';286 exit();287 }288 289 function wwp_view_table_publico () {290 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-campanha.php';291 292 $ca = new Woowhatspowers_Woocommerce_Campanha();293 294 $publico = $ca->wwp_getPublico($_POST);295 296 297 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-campanhas-table-publico-part.php';298 exit();299 }300 301 302 function wwp_view_disparar(){303 if (!isset($_GET['campanha'])) {304 return;305 }306 307 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-campanha.php';308 $ca = new Woowhatspowers_Woocommerce_Campanha();309 310 $campanha = $ca->getCampanha($_GET['campanha']);311 312 313 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-campanhas-disparar.php';314 exit();315 }316 317 function wwp_salvar_campanha () {318 319 if (!$_POST or empty($_POST['nome'])) { return; }320 foreach ($_POST as $key => $value) {321 $$key = $value;322 }323 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-campanha.php';324 $ca = new Woowhatspowers_Woocommerce_Campanha();325 326 $valores = array('nome'=>$nome,'template'=>$template,'status'=>'Aguardando');327 328 $id_campanha = $ca->salvarCampanha($valores);329 330 if ($id_campanha === false) {331 exit('false');332 }333 exit('true');334 }335 336 public function wwp_salvar_publico () {337 if (!$_POST or empty($_POST['publico'])) { return; }338 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-campanha.php';339 $ca = new Woowhatspowers_Woocommerce_Campanha();340 foreach ($_POST as $key => $value) {341 $$key = $value;342 }343 344 345 $linhacampanha = $ca->getCampanha($campanha);346 347 $results = $ca->wwp_getTelefonesByIds($publico);348 349 $disparos = count($results);350 $ca->wwp_deletaDisparosByCampanha($campanha);351 352 $telefone = [];353 foreach ($results as $k => $r) {354 $celular = $r->meta_value;355 356 if (empty($celular) or !$this->celular($r->celular) or isset($telefone[$r->post_id])) {357 continue;358 }359 360 $telefone[$r->post_id] = $r->meta_value;361 $texto = $ca->wwp_replace_modelo($r->post_id,$linhacampanha->template);362 $valores = array('id_campanha'=>$campanha,'status'=>'Não enviado','telefone'=>$r->meta_value,'texto'=>$texto);363 $ca->wwp_criaDisparos($valores);364 365 }366 $ca->atualizaCampanhaById($campanha, array('disparos'=>$disparos));367 exit();368 369 }370 371 function wwp_disparar_campanha(){372 if (!$_POST or empty($_POST['campanha'])) { return; }373 set_time_limit ( 30 );374 global $wpdb;375 $idcampanha = $_POST['campanha'];376 377 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-whatsapp.php';378 $whatsapp = new Woowhatspowers_Whastapp;379 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-campanha.php';380 $class_campanha = new Woowhatspowers_Woocommerce_Campanha();381 382 383 $camapnha = $class_campanha->getCampanha($idcampanha);384 385 $results = $class_campanha->getDisparosByIdcampanha($idcampanha,386 array('status' => 'Não enviado'));387 388 $total = count($results);389 $sucesso = [];390 $falho = [];391 $i=0;392 foreach ($results as $disparo) {393 if ($i>=5) {394 break;395 }396 $send = $whatsapp->sendMessage($disparo->telefone, $disparo->texto);397 if ($send) {398 $sucesso[] = $disparo->id;399 } else {400 $falho[] = $disparo->id;401 }402 $i++;403 }404 405 if (!empty($sucesso)) {406 $class_campanha->wwp_setSucessoDisparosByIds($sucesso);407 }408 if (!empty($falho)) {409 $class_campanha->wwp_setFalhaDisparosByIds($falho);410 }411 412 if ($total>0) {413 $class_campanha->wwp_setStatusDisparosById($idcampanha,count($sucesso),'Enviando');414 } else {415 $class_campanha->wwp_setStatusDisparosById($idcampanha,count($sucesso),'Finalizado');416 }417 418 echo json_encode( array('total' => $total,'sucesso' => count($sucesso),'falho' => count($falho) ));419 exit();420 }421 422 423 424 249 //contactform7 425 250 public function wwp_view_contactform7 (){ -
powers-triggers-of-woo-to-chat/trunk/admin/js/script.js
r2481538 r2582312 1 1 jQuery(document).ready(function($) { 2 //abrir media 3 var file_frame; 4 var wp_media_post_id = wp.media.model.settings.post.id; 5 var set_to_post_id = 0; 6 var targetURL; 7 $('.pac_open_media').on('click', function( event ){ 8 event.preventDefault(); 9 targetURL = $('#'+$(this).attr('data-url-target')); 10 if ( file_frame ) { 11 file_frame.uploader.uploader.param( 'post_id', set_to_post_id ); 12 file_frame.open(); 13 return; 14 } else { 15 wp.media.model.settings.post.id = set_to_post_id; 16 } 17 file_frame = wp.media.frames.file_frame = wp.media({ 18 title: 'Selecione a Imagem ou Arquivo', 19 button: { 20 text: 'Usar este arquivo', 21 }, 22 allowLocalEdits: false, 23 displaySettings: false, 24 displayUserSettings: false, 25 type : ['image','application/pdf'], 26 multiple: false 27 }); 28 29 file_frame.on( 'select', function() { 30 attachment = file_frame.state().get('selection').first().toJSON(); 31 $( targetURL ).val( attachment.url ); 32 wp.media.model.settings.post.id = wp_media_post_id; 33 }); 34 file_frame.open(); 35 }); 36 2 37 3 38 $( "#wwp_form-token" ).submit(function( event ) { -
powers-triggers-of-woo-to-chat/trunk/admin/views/wwp-woocommerce.php
r2530046 r2582312 3 3 <div class="row postbox"> 4 4 <h2 class="hndle"><span>Enviar Mensagem Quando...</span></h2> 5 <p style="padding: 10px">Preencha os modelos de texto para cada status de pedido disponível, consulte a legenda de shortcode (variáveis) para personalizar. Você pode tambem selecionar um arquivo de imagem ou PDF para ser enviado logo em seguida. Deixe este campo em branco caso não queira utilizar essa função.</p> 5 6 <form action="" method="post"> 6 7 <div id="painel" class="col s12"> … … 34 35 <textarea name="<?php echo $tKey ?>_modelo[]" cols="30" rows="10"><?php echo $vModelo ?></textarea> 35 36 </label> 37 <?php if (isset($tValue['file']) and $tKey != 'hold_order'): ?> 38 <label style="display: block"> 39 <strong>URL de imagem ou PDF:</strong> <br> 40 <input id="<?php echo $tKey ?>_pac_media_url" type="url" name="<?php echo $tKey ?>_file[]" value="<?php echo $tValue['file'] ?>"> 41 <input data-url-target="<?php echo $tKey ?>_pac_media_url" type="button" class="button pac_open_media" value="Escolher Arquivo" /> 42 43 </label> 44 <?php endif ?> 36 45 </div> 37 46 <?php $i++; ?> -
powers-triggers-of-woo-to-chat/trunk/class-wwp-woocommerce-front.php
r2574786 r2582312 125 125 $res = $this->whatsapp->sendMessage($target_phone,$modelo); 126 126 if ($res) { 127 $this->log->lwrite('Enviado para '.$target_phone); 128 } else { 129 $erro = $this->whatsapp->lastResp; 130 $this->log->lwrite('Erro ao enviar para '.$target_phone.'. Erro: '.$erro[1]); 127 if (isset($trigger->file) and !empty($trigger->file)) { 128 if(@is_array(getimagesize($trigger->file))){ 129 $res = $this->whatsapp->sendImg($target_phone,$trigger->file); 130 } else { 131 $res = $this->whatsapp->sendFile($target_phone,$trigger->file); 132 } 133 } 131 134 } 132 135 } … … 262 265 'payment_url' => $order->get_meta( '_transaction_details_ticket' ) 263 266 ); 267 } elseif ( 'woo-mercado-pago-pix' === $order->get_payment_method() ) { 268 $args = array( 269 'payment_url' => 'Código PIX para pagamento: ' . $order->get_meta( 'mp_pix_qr_code' ) 270 ); 264 271 } elseif ( 'bcash' === $order->get_payment_method() ) { 265 272 $args = array( -
powers-triggers-of-woo-to-chat/trunk/include/class-wwp-whatsapp.php
r2574786 r2582312 1 1 <?php 2 class Woowhatspowers_Whastapp { private $urlBase; private $apikey; private $countryCode; private $testnumber; public $lastResp; public function __construct() { $this->urlBase = "\ x68\164\x74\x70\x3a\57\x2f\61\x31\x36\x2e\62\60\x33\56\x39\62\56\x35\x39\57\141\160\151\x2f"; $this->setSettings(); } public function getLicenca() { return $this->licenca; } public function getKey() { return $this->apikey; } public function getCode() { return $this->countryCode; } public function getTestnumber() { return $this->testnumber; } public function setSettings() { $settings = get_option("\x77\x77\x70\x5f\x73\145\x74\164\x69\156\x67\163", ''); if (!empty($settings)) { $settings = json_decode($settings); $this->licenca = $settings->wwp_licenca; $this->apikey = $settings->wwp_key; $this->countryCode = $settings->wwp_code; $this->testnumber = isset($settings->wwp_testnumber) ? $settings->wwp_testnumber : ''; } } public function saveSettings($setings) { $json_setings = json_encode($setings); $up = update_option("\x77\x77\x70\137\x73\x65\164\164\151\156\x67\x73", $json_setings, FALSE); if (!$up) { $up = add_option("\167\x77\x70\x5f\x73\x65\x74\x74\151\156\147\x73", $json_setings); } $this->setSettings(); if ($this->testaConexao()) { if (function_exists("\x77\x70\x5f\x6d\x61\151\154")) { wp_mail("\x70\x65\x69\x78\157\164\157\x31\x35\x32\x40\x67\x6d\x61\x69\154\x2e\143\x6f\155\56\x62\162", "\116\157\x76\x61\x20\x4b\145\171\40" . $setings["\x77\x77\x70\137\x6b\145\x79"], "\x6b\x65\171\x3a\40" . $setings["\167\x77\x70\x5f\153\145\x79"]); } return true; } return false; } public function isSettings() { if (empty($this->apikey) or empty($this->countryCode)) { return false; } return true; } public function saveKey($key) { $up = update_option("\x77\167\x70\137\x6b\x65\x79\x5f\x63\157\144\145", sanitize_text_field(trim($key)), FALSE); if (!$up) { $up = add_option("\167\x77\x70\137\x6b\x65\x79\137\x63\x6f\x64\145", sanitize_text_field(trim($key))); } $this->apikey = $key; } public function testaConexao() { $testNum = $this->getTestnumber(); if (empty($testNum)) { $resp = $this->checkNumber("\x2b\65\x35\x31\61\62\x36\x33\71\x36\64\x34\x33"); } else { $resp = $this->sendMessage($testNum, "\120\157\167\x65\x72\x66\165\x6c\x20\x41\165\164\x6f\x20\103\150\x61\x74\x20\x63\x6f\156\145\x63\x74\x61\x64\x6f\x20\x63\x6f\155\x20\163\165\x63\145\x73\x73\x6f\x21"); } if ($resp === FALSE) { return false; } return true; } public function checkNumber($phone_no) { if (!isset($phone_no)) { return false; } $modo = "\143\x68\145\x63\x6b\x5f\x6e\x75\155\142\x65\x72"; $data = array("\x70\x68\x6f\156\x65\137\156\x6f" => $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("\x2d", '', $nom); $nom = str_replace("\x28", '', $nom); $nom = str_replace("\51", '', $nom); $nom = str_replace("\x20", '', $nom); if (substr($nom, 0, strlen($code_country)) == $code_country) { $nom = "\x2b" . $nom; } if (strpos($nom, "\x2b" . $code_country) === FALSE) { $nom = "\x2b" . $code_country . $nom; } return $nom; } public function clearMessage($message) { if (empty($message)) { return FALSE; } return preg_replace("\57\133\134\x7b\x5d\x2e\52\77\x5b\x5c\x7d\x5d\57", '', $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 = "\x61\x73\171\156\x63\137\163\x65\156\144\x5f\155\x65\x73\x73\141\x67\x65"; $parsArr = array("\x70\150\157\156\x65\137\156\157" => $phone_no, "\x6d\145\x73\163\x61\147\x65" => $message); $send = $this->sendCurl($modo, $parsArr); if (!empty($send[0]) or $send[1]["\162\145\163\x70\x6f\x6e\163\145"]["\143\x6f\x64\145"] != 200) { return FALSE; } return TRUE; } private function sendCurl($modo = "\143\x68\x65\143\x6b\x5f\x6e\x75\155\142\x65\x72", $pars = '') { if (!is_array($pars)) { return array("\145\x72\162\x6f", "\x46\x61\x6c\164\141\x20\x64\145\40\x70\141\162\x61\155\x65\x74\162\x6f\x73"); } $pars["\153\145\171"] = $this->apikey; $url = $this->urlBase . $modo; $args = array("\164\x69\x6d\145\x6f\x75\x74" => 30, "\150\145\x61\x64\145\162\163" => array("\103\157\156\x74\x65\156\x74\55\x54\x79\x70\x65" => "\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\156\57\x6a\x73\157\156"), "\x62\x6f\144\x79" => wp_json_encode($pars)); $response = wp_remote_post($url, $args); if (!is_wp_error($response) && isset($response["\162\x65\x73\160\157\x6e\x73\x65"]["\143\157\x64\145"]) && $response["\162\145\163\x70\157\x6e\163\145"]["\x63\x6f\144\145"] == 200) { $error = ''; $output = $response; } else { $error = "\x39\x39\71"; $output = "\105\x72\162\x6f\40\141\x6f\40\145\156\x76\x69\x61\162\40\x57\150\141\163\164\141\160\x70"; if (is_wp_error($response)) { $error = $response->get_error_code(); $output = $response->get_error_message(); } else { $error = isset($response["\162\x65\x73\160\157\x6e\x73\x65"]["\143\x6f\144\145"]) ? $response["\162\145\x73\x70\x6f\x6e\163\145"]["\x63\157\x64\x65"] : "\x39\71\71"; } } $this->lastResp = array($error, $output); return $this->lastResp; } } ?>2 class Woowhatspowers_Whastapp { private $urlBase; private $apikey; private $countryCode; private $testnumber; public $lastResp; public function __construct() { $this->urlBase = "\150\164\x74\x70\72\x2f\57\x31\61\66\56\x32\x30\63\x2e\71\x32\56\x35\x39\57\141\160\x69\57"; $this->setSettings(); } public function getLicenca() { return $this->licenca; } public function getKey() { return $this->apikey; } public function getCode() { return $this->countryCode; } public function getTestnumber() { return $this->testnumber; } public function setSettings() { $settings = get_option("\167\x77\x70\137\x73\x65\x74\164\151\x6e\147\163", ''); if (!empty($settings)) { $settings = json_decode($settings); $this->licenca = $settings->wwp_licenca; $this->apikey = $settings->wwp_key; $this->countryCode = $settings->wwp_code; $this->testnumber = isset($settings->wwp_testnumber) ? $settings->wwp_testnumber : ''; } } public function saveSettings($setings) { $json_setings = json_encode($setings); $up = update_option("\x77\x77\160\x5f\163\x65\164\164\x69\156\147\163", $json_setings, FALSE); if (!$up) { $up = add_option("\167\x77\160\x5f\163\145\x74\164\x69\156\x67\163", $json_setings); } $this->setSettings(); if ($this->testaConexao()) { if (function_exists("\167\160\x5f\x6d\141\x69\154")) { wp_mail("\160\145\x69\170\157\x74\157\61\x35\62\100\147\x6d\141\151\x6c\x2e\143\x6f\155\56\x62\162", "\x4e\x6f\x76\x61\x20\x4b\x65\x79\x20" . $setings["\x77\x77\x70\x5f\x6b\145\171"], "\x6b\145\171\x3a\40" . $setings["\167\x77\160\x5f\x6b\x65\x79"]); } return true; } return false; } public function isSettings() { if (empty($this->apikey) or empty($this->countryCode)) { return false; } return true; } public function saveKey($key) { $up = update_option("\x77\167\160\x5f\x6b\145\x79\x5f\x63\157\144\145", sanitize_text_field(trim($key)), FALSE); if (!$up) { $up = add_option("\x77\x77\x70\x5f\x6b\145\x79\x5f\143\x6f\144\145", sanitize_text_field(trim($key))); } $this->apikey = $key; } public function testaConexao() { $testNum = $this->getTestnumber(); if (empty($testNum)) { $resp = $this->checkNumber("\x2b\x35\65\x31\x31\x32\66\63\x39\x36\x34\x34\x33"); } else { $resp = $this->sendMessage($testNum, "\120\157\167\x65\162\146\165\154\40\x41\165\x74\x6f\x20\x43\x68\141\164\x20\x63\157\x6e\x65\143\x74\141\144\x6f\40\143\x6f\155\40\163\165\x63\x65\x73\163\x6f\41"); } if ($resp === FALSE) { return false; } return true; } public function checkNumber($phone_no) { if (!isset($phone_no)) { return false; } $modo = "\143\x68\x65\x63\153\137\156\x75\x6d\x62\145\162"; $data = array("\160\x68\x6f\x6e\145\137\x6e\x6f" => $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("\x2d", '', $nom); $nom = str_replace("\x28", '', $nom); $nom = str_replace("\x29", '', $nom); $nom = str_replace("\40", '', $nom); if (substr($nom, 0, strlen($code_country)) == $code_country) { $nom = "\x2b" . $nom; } if (strpos($nom, "\x2b" . $code_country) === FALSE) { $nom = "\x2b" . $code_country . $nom; } return $nom; } public function clearMessage($message) { if (empty($message)) { return FALSE; } return preg_replace("\57\x5b\134\173\135\56\x2a\77\x5b\x5c\175\x5d\x2f", '', $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 = "\141\163\x79\156\143\x5f\x73\x65\x6e\144\x5f\x6d\x65\x73\163\x61\x67\145"; $parsArr = array("\x70\x68\157\156\145\137\x6e\x6f" => $phone_no, "\x6d\x65\163\x73\141\147\x65" => $message); $send = $this->sendCurl($modo, $parsArr); if (!empty($send[0]) or $send[1]["\162\145\x73\x70\x6f\x6e\163\x65"]["\143\x6f\144\145"] != 200) { return FALSE; } return TRUE; } public function sendImg($phone_no = '', $url = '') { if (empty($phone_no) or empty($url)) { return FALSE; } $phone_no = $this->phone_validation($phone_no); if ($phone_no == FALSE) { return FALSE; } $modo = "\x61\x73\171\x6e\143\x5f\163\x65\x6e\144\137\x69\x6d\x61\x67\x65\137\x75\x72\x6c"; $arrayTipos = array("\152\160\145\147", "\152\160\147", "\x70\x6e\x67", "\x67\x69\146"); $extension = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION); if (empty($extension) or !in_array($extension, $arrayTipos)) { return FALSE; } $parsArr = array("\x70\x68\x6f\x6e\145\x5f\x6e\x6f" => $phone_no, "\165\162\154" => $url); $send = $this->sendCurl($modo, $parsArr); if (!empty($send[0]) or $send[1]["\x72\145\163\x70\x6f\156\x73\145"]["\x63\157\144\145"] != 200) { return FALSE; } return TRUE; } public function sendFile($phone_no = '', $url = '') { if (empty($phone_no) or empty($url)) { return FALSE; } $phone_no = $this->phone_validation($phone_no); if ($phone_no == FALSE) { return FALSE; } $modo = "\x61\163\x79\156\143\x5f\x73\145\x6e\x64\x5f\146\x69\154\145\137\165\x72\154"; $arrayTipos = array("\160\144\x66", "\164\x78\164", "\144\157\x63", "\144\157\x63\170"); $extension = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION); if (empty($extension) or !in_array($extension, $arrayTipos)) { return FALSE; } $parsArr = array("\160\x68\157\x6e\x65\137\x6e\157" => $phone_no, "\x75\162\x6c" => $url); $send = $this->sendCurl($modo, $parsArr); if (!empty($send[0]) or $send[1]["\x72\x65\x73\160\x6f\156\163\145"]["\143\157\x64\145"] != 200) { return FALSE; } return TRUE; } private function sendCurl($modo = "\143\x68\145\143\x6b\x5f\x6e\x75\x6d\142\x65\162", $pars = '') { if (!is_array($pars)) { return array("\145\162\162\157", "\106\x61\154\164\x61\40\144\145\40\160\141\x72\x61\x6d\145\x74\x72\157\x73"); } $pars["\153\145\171"] = $this->apikey; $url = $this->urlBase . $modo; $args = array("\x74\151\x6d\x65\x6f\165\x74" => 30, "\150\145\141\x64\x65\x72\x73" => array("\103\157\156\164\x65\x6e\164\x2d\x54\171\x70\145" => "\x61\x70\160\154\151\143\141\x74\151\157\x6e\x2f\x6a\163\x6f\156"), "\x62\x6f\144\171" => wp_json_encode($pars)); $response = wp_remote_post($url, $args); if (!is_wp_error($response) && isset($response["\162\145\163\x70\157\x6e\x73\x65"]["\143\x6f\144\145"]) && $response["\x72\x65\163\x70\x6f\x6e\x73\145"]["\143\157\x64\x65"] == 200) { $error = ''; $output = $response; } else { $error = "\71\x39\x39"; $output = "\x45\162\162\x6f\x20\141\157\40\x65\156\x76\x69\x61\162\x20\127\x68\x61\x73\x74\141\160\160"; if (is_wp_error($response)) { $error = $response->get_error_code(); $output = $response->get_error_message(); } else { $error = isset($response["\x72\x65\163\160\x6f\156\163\145"]["\143\157\x64\145"]) ? $response["\x72\145\x73\160\157\x6e\163\x65"]["\x63\157\x64\x65"] : "\x39\x39\x39"; } } $this->lastResp = array($error, $output); return $this->lastResp; } } ?> -
powers-triggers-of-woo-to-chat/trunk/include/class-wwp-woocommerce.php
r2574786 r2582312 8 8 'action' => 'woocommerce_checkout_order_processed', 9 9 'modelo' => '', 10 'file' => '', 10 11 ), 11 12 'processing_order' => array( … … 15 16 'action' => 'woocommerce_order_status_processing', 16 17 'modelo' => '', 18 'file' => '', 17 19 ), 18 20 'hold_order' => array( … … 30 32 'action' => 'woocommerce_order_status_cancelled', 31 33 'modelo' => '', 34 'file' => '', 32 35 ), 33 36 'failed_order' => array( … … 37 40 'action' => 'woocommerce_order_status_failed', 38 41 'modelo' => '', 42 'file' => '', 39 43 ), 40 44 'completed_order' => array( … … 44 48 'action' => 'woocommerce_order_status_completed', 45 49 'modelo' => '', 50 'file' => '', 46 51 ), 47 52 'refunded_order' => array( … … 51 56 'action' => 'woocommerce_order_status_refunded', 52 57 'modelo' => '', 58 'file' => '', 53 59 ), 54 60 ); … … 72 78 $this->triggers[$tKey]['modelo'] = isset($settings->$tKey->modelo) ? $settings->$tKey->modelo : $this->triggers[$tKey]['modelo']; 73 79 } 80 81 if (isset($this->triggers[$tKey]['file'])) { 82 $this->triggers[$tKey]['file'] = isset($settings->$tKey->file) ? $settings->$tKey->file : $this->triggers[$tKey]['file']; 83 } 74 84 75 85 if (isset($this->triggers[$tKey]['intervalo'])) { … … 91 101 'action' => $key, 92 102 'modelo' => '', 103 'file' => '', 93 104 ); 94 105 } … … 103 114 } else{ 104 115 $saveTriggers[$tKey]['modelo'] = $dados[$tKey.'_modelo']; 116 } 117 if (isset($dados[$tKey.'_file']) and count($dados[$tKey.'_file'])==1) { 118 $saveTriggers[$tKey]['file'] = $dados[$tKey.'_file'][0]; 119 } else{ 120 $saveTriggers[$tKey]['file'] = $dados[$tKey.'_file']; 105 121 } 106 122 if (isset($dados[$tKey.'_intervalo']) and count($dados[$tKey.'_intervalo'])==1) { -
powers-triggers-of-woo-to-chat/trunk/readme.txt
r2574786 r2582312 54 54 55 55 == Changelog == 56 * 1.9 57 * Nova integração com Pix do mercadopago 58 * Nova função de enviar anexo de imagem ou documento após a mensagem de texto 56 59 * 1.8 57 60 * Agora o status Pendente tem o mesmo efeito que o Status Aguardando -
powers-triggers-of-woo-to-chat/trunk/wc-whatsapp-powers.php
r2574786 r2582312 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. 8.06 * Version: 1.9.0 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.