Changeset 3023994
- Timestamp:
- 01/19/2024 10:32:30 AM (2 years ago)
- Location:
- telsender/trunk
- Files:
-
- 12 edited
-
clasess/TelegramSend.php (modified) (6 diffs)
-
clasess/TelsenderCore.php (modified) (4 diffs)
-
clasess/TelsenderWc.php (modified) (1 diff)
-
clasess/TscfwcSetting.php (modified) (1 diff)
-
clasess/log.php (modified) (1 diff)
-
css/telsender.css (modified) (2 diffs)
-
index.php (modified) (1 diff)
-
readme.md (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
-
template/list-shortcode-html.php (modified) (2 diffs)
-
template/log.php (modified) (1 diff)
-
template/view.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
telsender/trunk/clasess/TelegramSend.php
r2979054 r3023994 6 6 exit; 7 7 } 8 9 use pechenki\Telsender\clasess\log; 10 8 11 /** 9 12 * curl sender … … 22 25 * @var false|mixed|string $Pechenki_key 23 26 */ 24 public $Pechenki_key;25 27 /** 26 28 * @var mixed|string $Chat_id … … 31 33 */ 32 34 public $Token; 33 /**34 * @var bool $isSendPechenki35 */36 35 public $isSendPechenki; 37 36 /** … … 57 56 $tscfwc_setting = new TscfwcSetting(get_option(TSCFWC_SETTING)); 58 57 59 $this->Pechenki_key = $tscfwc_setting->Option('tscfwc_setting_newtoken');60 58 $this->Chat_id = $tscfwc_setting->Option('tscfwc_setting_chatid'); 61 59 $this->Token = $tscfwc_setting->Option('tscfwc_setting_token'); … … 64 62 $this->isSendPechenki = $opt['tscfwc_key']; 65 63 } 66 67 64 68 65 } … … 114 111 115 112 if (is_wp_error($return)) { 113 114 log::setLog( $return->get_error_message()); 116 115 117 116 return json_encode(['ok' => false, 'curl_error_code' => $return->get_error_message()]); -
telsender/trunk/clasess/TelsenderCore.php
r2979054 r3023994 18 18 { 19 19 20 public $version = '1.14. 6';20 public $version = '1.14.9'; 21 21 22 22 /** … … 58 58 if (!$this->tscfwc_enabled) return; 59 59 60 61 if ( $this->tscfwc_setLog){ 62 define('LOG_TS',true); 63 $log = new log(); 64 65 } 66 60 67 add_action('wpforms_process_complete', array($this, 'tscfwc_wp_form'), 10, 4); 61 68 add_action('woocommerce_after_order_object_save', array($this, 'tscfwc_woocommerce_new_order_status'), 99, 2); 62 69 if ($this->tscfwc_setting_acsesform) { 63 add_action("wpcf7_mail_sent", array($this, 'wpcf7_tscfwc'), 99, 1); 64 } 70 add_action("wpcf7_mail_sent", array($this, 'sendCF7'), 99, 1); 71 } 72 65 73 66 74 } … … 218 226 */ 219 227 220 public function wpcf7_tscfwc($ccg)228 public function sendCF7($ccg) 221 229 { 222 230 … … 305 313 'tscfwc_setting_token' => $this->post('tscfwc_setting_token'), 306 314 'tscfwc_setting_chatid' => htmlentities($this->post('tscfwc_setting_chatid')), 315 'tscfwc_setLog' => intval($this->post('tscfwc_setLog')), 307 316 'tscfwc_setting_wooc_template' => htmlentities($this->post('tscfwc_setting_wooc_template')), 308 317 'tscfwc_setting_setcheck' => array( -
telsender/trunk/clasess/TelsenderWc.php
r2979054 r3023994 84 84 $res = preg_replace('/\{|\}/', '', $item); 85 85 86 if (isset($this->order->data[$res])) { 86 87 $_result = $this->order->data[$res]; 87 if ($_result) { 88 $this->replace[$item] = $_result; 89 } else { 90 $this->replace[$item] = $this->order->get_meta($res) ?: ''; 91 } 88 }else{ 89 $_result = null; 90 } 91 92 93 if ($_result) { 94 $this->replace[$item] = $_result; 95 } else { 96 $this->replace[$item] = $this->order->get_meta($res) ?: ''; 97 } 98 92 99 93 100 -
telsender/trunk/clasess/TscfwcSetting.php
r2979054 r3023994 37 37 'tscfwc_setting_wooc_template' => '', 38 38 'tscfwc_setting_acsesform' => [], 39 'tscfwc_setLog' => false, 39 40 'tscfwc_setting_status_wc' => [ 40 41 'wc-processing' -
telsender/trunk/clasess/log.php
r2979054 r3023994 3 3 namespace pechenki\Telsender\clasess; 4 4 5 if ( ! defined( 'ABSPATH' )) {5 if (!defined('ABSPATH')) { 6 6 exit; 7 7 } 8 class log{ 9 10 static $logNameOption = 'telsenderLog'; 8 9 class log 10 { 11 11 12 12 13 const path = ABSPATH . "wp-content/uploads/telsender/error.log"; 13 14 14 public static function setLog($text){ 15 16 if($text){ 17 $log = []; 18 $real = json_decode(self::getLog(),true)?:[]; 19 20 $log['date'] = time(); 21 $log['data'] = $text; 22 $real[]=$log; 23 return update_option(self::$logNameOption,json_encode($real)); 24 } 25 return false; 15 public function __construct() 16 { 17 $this->initLogFile(); 26 18 } 27 19 28 public static function getLog(){ 29 return get_option(self::$logNameOption); 20 /** 21 * @param $text 22 * @return void 23 */ 24 public static function setLog($text) 25 { 26 if (!defined('LOG_TS')) return; 27 28 if (is_array($text)) { 29 $text = json_encode($text); 30 } 31 $file = fopen(self::path, "a+"); 32 echo fwrite($file, "\n" . date('Y-m-d h:i:s') . " :: " . $text); 33 fclose($file); 30 34 } 31 35 32 public static function clearLog(){ 33 return update_option(self::$logNameOption,''); 36 /** 37 * @return false|string 38 */ 39 public static function getLog() 40 { 41 42 if (!file_exists(self::path)) { 43 return 'error none'; 44 } 45 return trim(file_get_contents(self::path)); 46 } 47 48 49 public static function clearLog() 50 { 51 return update_option(self::$logNameOption, ''); 52 } 53 54 /** 55 * @return void 56 */ 57 private function initLogFile() 58 { 59 if (file_exists(self::path)) return; 60 61 $upload = wp_upload_dir(); 62 $upload_dir = $upload['basedir']; 63 $upload_dir = $upload_dir . '/telsender'; 64 if (!is_dir($upload_dir)) { 65 mkdir($upload_dir, 0755); 66 } 67 try { 68 fopen(self::path, 'x'); 69 file_put_contents($upload_dir . '/.htaccess', 'deny from all'); 70 }catch (\Exception $e){ 71 72 } 73 74 34 75 } 35 76 } -
telsender/trunk/css/telsender.css
r2979054 r3023994 38 38 39 39 #formsetinvendor input { 40 border-radius: 0;40 border-radius: 5px; 41 41 margin: 1px 0; 42 42 } … … 801 801 background: #006d8830; 802 802 border-radius: 5px; 803 max-height: 450px; 804 overflow: auto; 803 805 } 804 806 .telsenderSetting input[type="checkbox"]{ -
telsender/trunk/index.php
r2979054 r3023994 8 8 Description: Плагін відправляє заявки з форм у телеграм канал 9 9 Author: Pechenki 10 Version: 1.14. 810 Version: 1.14.9 11 11 Author URI: https://coder.org.ua/dev/wordpress/telsender 12 12 */ -
telsender/trunk/readme.md
r2979054 r3023994 3 3 Tags: telegram, Сontact form 7 to telegram, Сontact form 7, wooccommerce to telegram, Wpforms to telegram, wpforms to telegram 4 4 Requires at least: 4.8 5 Requires PHP: 5.66 Tested up to: 6. 37 Stable tag: 1.14. 75 Requires PHP: 7.4 6 Tested up to: 6.4 7 Stable tag: 1.14.9 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 37 37 more details on the site 38 38 39 https:// pechenki.top/telsender.html39 https://coder.org.ua/dev/wordpress/telsender 40 40 41 41 == Screenshots == … … 46 46 47 47 == Changelog == 48 = 1.14.9 = 49 - add log file 50 - fix error 51 48 52 = 1.14.8 = 49 53 - add chat id from wooccommerce -
telsender/trunk/readme.txt
r2979054 r3023994 3 3 Tags: telegram, Сontact form 7 to telegram, Сontact form 7, wooccommerce to telegram, Wpforms to telegram, wpforms to telegram 4 4 Requires at least: 4.8 5 Requires PHP: 5.66 Tested up to: 6. 37 Stable tag: 1.14. 85 Requires PHP: 7.4 6 Tested up to: 6.4 7 Stable tag: 1.14.9 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 65 65 more details on the site 66 66 67 https:// pechenki.top/telsender.html67 https://coder.org.ua/dev/wordpress/telsender 68 68 69 69 == Screenshots == … … 74 74 75 75 == Changelog == 76 = 1.14.9 = 77 - add log file 78 - fix error 79 76 80 = 1.14.8 = 77 81 - add chat id from wooccommerce -
telsender/trunk/template/list-shortcode-html.php
r2952090 r3023994 1 < code><pre>1 <pre> 2 2 woocommerce - shortcode 3 3 /***/ … … 22 22 {customer_user_agent} 23 23 </pre> 24 </code> 24 -
telsender/trunk/template/log.php
r2867750 r3023994 1 <?php 2 3 use pechenki\Telsender\clasess\log; 4 ?> 5 <hr> 1 6 <div class="log0wrap"> 2 <table> 3 <tbody> 4 <tr> 5 <td>Date</td> 6 <td>Content</td> 7 </tr> 8 <?php 9 if (log::getLog()) { 10 foreach (json_decode(log::getLog(), true) as $keyl => $valuel) { 11 $code = json_decode($valuel['data']); 7 <p>Log</p> 8 <pre><?php echo log::getLog(); ?> </pre> 9 </div> 12 10 13 echo '<tr>'; 14 echo '<td class="log-date">' . date("Y-m-d H:i:s", $valuel["date"]) . '</td>'; 15 echo '<td class="log-data">' . esc_attr($valuel['data']) . '</td>'; 16 echo '</tr>'; 17 } 18 } 19 ?> 20 </tbody> 21 </table> 22 </div> 11 <style> 12 .log0wrap pre{ 13 overflow:auto; 14 max-height: 300px; 15 } 16 </style> -
telsender/trunk/template/view.php
r2979054 r3023994 4 4 } 5 5 6 use pechenki\Telsender\clasess\log; 6 7 7 8 8 $caunt = 0; … … 49 49 </label> 50 50 </div> 51 51 52 <div> 52 53 <label> … … 55 56 name="tscfwc_setting_chatid" 56 57 placeholder=""/></label> 58 </div> 59 60 <div> 61 <input value="0" type="hidden" name="tscfwc_setLog" type="checkbox"/> 62 <input value="1" <?php echo checked($this->tscfwc_setLog); ?> name="tscfwc_setLog" 63 type="checkbox"/> 64 <span>Log</span> 57 65 </div> 58 66 </fieldset> … … 129 137 </a> 130 138 <?php include 'list-shortcode-html.php'; ?> 139 <?php $this->render('template/log', []); ?> 131 140 </td> 132 141
Note: See TracChangeset
for help on using the changeset viewer.