Plugin Directory

Changeset 3256233


Ignore:
Timestamp:
03/15/2025 11:59:30 AM (13 months ago)
Author:
cnfang
Message:

2.8.0

Location:
wxsync/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wxsync/trunk/readme.txt

    r2958751 r3256233  
    33Donate link: http://std.cloud
    44Tags: 微信公众号,免费,公众号文章采集,数据采集,微信公众号采集
    5 Stable tag: 2.7.25
     5Stable tag: 2.8.0
    66Tested up to: 6.3
    77License: GPLv2 or later
     
    3232
    3333== Changelog ==
     342.8.0  修复微信无法采集
     35
    34362.7.25 修复bug
    3537
  • wxsync/trunk/wxsync.php

    r2958751 r3256233  
    44Plugin URI: http://std.cloud
    55Description: 标准云微信公众号文章免费采集、<strong>任意公众号自动采集付费购买</strong>
    6 Version: 2.7.25
     6Version: 2.8.0
    77Author: 标准云(std.cloud)
    88Author URI: http://std.cloud
     
    2424$GLOBALS['wxsync_tab'] = '';
    2525$GLOBALS['wxsync_error'] = array();
    26 $GLOBALS['wxsync_ver'] = '2.7.25';
     26$GLOBALS['wxsync_ver'] = '2.8.0';
    2727$GLOBALS['wxsync_code'] = 0;
    2828
     
    5353
    5454function wxsync_onrequest(){
    55     error_reporting(E_ERROR);
     55
    5656
    5757    $req = array();
    5858
    5959    $keys = array('wxsync_tab','article_urls','wxsync_settoken','wxsync_token','article_thumbnail'
    60             ,'urls','override','article_time','article_status','article_cate','article_source','article_style','wxsync_setsourcetxt','article_type','article_checkrepeat'
    61             ,'wxsync_rmheadimg','wxsync_rmtailimg','wxsync_replace_words','article_imgurl','article_href','article_debug','article_raw'
    62             ,'host','port','username','password','article_remotetag','article_remote_a_href'
    63             ,'article_userid','article_removeblank','article_tags','wxsync_autoproxyset_token'
     60    ,'urls','override','article_time','article_status','article_cate','article_source','article_style','wxsync_setsourcetxt','article_type','article_checkrepeat'
     61    ,'wxsync_rmheadimg','wxsync_rmtailimg','wxsync_replace_words','article_imgurl','article_href','article_debug','article_raw'
     62    ,'host','port','username','password','article_remotetag','article_remote_a_href'
     63    ,'article_userid','article_removeblank','article_tags','wxsync_autoproxyset_token'
    6464    );
    6565    foreach ($keys as $one){
     
    9494    $GLOBALS['wxsync_tab'] = $req['wxsync_tab'];
    9595    if($req['wxsync_tab'] == 'manual'){
     96        // 验证Nonce
     97        if (isset($_POST['wxsync_nonce_field'])) {
     98            // 验证nonce
     99            if (wp_verify_nonce($_POST['wxsync_nonce_field'], 'wxsync_manual_action')) {
     100                // 你的代码逻辑
     101            } else {
     102                // 非法请求
     103                echo '你没有权限执行这个操作';
     104                array_push($GLOBALS['wxsync_error'],'你没有权限执行这个操作');
     105                return;
     106            }
     107        }
     108
     109
    96110        if(!is_admin()){
    97111            return;
     
    130144        ));
    131145    }else if($req['wxsync_tab'] == 'autoset'){
    132          if(isset($req['wxsync_settoken'])){
     146        if(isset($req['wxsync_settoken'])){
    133147            if(!is_admin()){
    134148                return;
    135149            }
    136150            global $wpdb,$table_prefix;
    137              $find = $wpdb->get_var("SHOW TABLES LIKE '{$table_prefix}wxsync_config'");
     151            $find = $wpdb->get_var("SHOW TABLES LIKE '{$table_prefix}wxsync_config'");
    138152            if (empty($find)) {
    139153                $sql = "CREATE TABLE `{$table_prefix}wxsync_config` (
     
    565579            $html = $article_raw[$index - 1];
    566580        }else{
    567             $output = wp_remote_get( $url, array('timeout' => 30));
     581            $output = wp_remote_get( $url, array('timeout' => 30,
     582                'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
     583                'Referer'      => 'https://weixin.sogou.com',
     584            ));
    568585            $html = wp_remote_retrieve_body( $output );
    569586            $check = json_encode($html);
     
    872889                }
    873890            }
    874            
     891
    875892            if('keep' == $article_thumbnail && !empty($vardict['thumbnail'])){
    876893                set_post_thumbnail($pid, $vardict['thumbnail']);
     
    897914    require_once(ABSPATH . 'wp-admin/includes/image.php');
    898915
    899 //    $tmp = download_url( $url );
     916
     917
    900918    $url = str_replace('&amp;', '&', $url);
    901919    $tmpfname = wp_tempnam(basename(parse_url($url, PHP_URL_PATH)));
     
    904922    $newname = 'wxsync-'.date('Y-m').'-'.md5($url).'.' . $type;
    905923
    906     $resid = get_attachment_url_by_title('wxsync-'.date('Y-m').'-'.md5($url));
     924    $resid = 0;//get_attachment_url_by_title('wxsync-'.date('Y-m').'-'.md5($url));
    907925    if($resid > 0){
    908926        $att_id = $resid;
    909927    }else{
    910928        global $tmp_proxy;
    911         $is_remote_daili = false;
    912         $is_remote_daili_ret = '';
    913         if(empty($tmp_proxy)){
    914             //本地没有,从主站获取
    915             global $wpdb,$table_prefix;
    916 
    917             $sql = "select * from {$table_prefix}wxsync_config where id = 4";
    918             $sql = $wpdb->prepare($sql,array());
    919             $cfgtxt = $wpdb->get_row($sql,ARRAY_A,0);
    920             if(!empty($cfgtxt)){
    921                 $wxsync_autoproxyset_token = $cfgtxt['token'];
    922                 $is_remote_daili = true;
    923 
    924                 $url_proxy = "http://proxyip.std.cloud/web/api/Proxyip/getip?token=$wxsync_autoproxyset_token";
    925                 $ch = curl_init();
    926                 curl_setopt($ch, CURLOPT_URL, $url_proxy);
    927                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    928                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    929                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    930                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
    931                 $str = curl_exec($ch);
    932                 curl_close($ch);
    933 
    934                 $is_remote_daili_ret = $str;
    935                 $obj_s = json_decode($str,true);
    936                 if(!empty($obj_s['info']['ip'])){
    937                     $tmp_proxy = [
    938                         'host'=>$obj_s['info']['ip'],
    939                         'port'=>$obj_s['info']['port'],
    940                         'username'=>$obj_s['info']['key'],
    941                         'password'=>$obj_s['info']['auth'],
    942                     ];
    943 
    944                 }
    945             }
    946 
    947         }
     929
     930
    948931
    949932        $tmp = wp_safe_remote_get($url, array('filename' => $tmpfname,'stream' => true,'timeout' => 300
    950             ,'headers' => array('referer' => $url),
    951             'user-agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1',
     933        ,'headers' => array('referer' => 'https://mp.weixin.qq.com/'),
     934            'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
    952935        ));
     936
    953937        if ( is_wp_error( $tmp ) ) {
    954             $UserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1';
     938            $UserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36';
    955939            $ch = curl_init();
    956940            curl_setopt($ch, CURLOPT_URL, $url);
     
    958942            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    959943            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    960             curl_setopt($ch, CURLOPT_REFERER, $url);
     944            curl_setopt($ch, CURLOPT_REFERER, 'https://mp.weixin.qq.com/');
    961945            curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent);
    962946            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
     
    969953//                                    curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
    970954                curl_setopt($ch,CURLOPT_PROXYUSERPWD,$userAndPass);    // curl_setopt($ch,CURLOPT_PROXYUSERPWD,'user:password');
    971             }else{
    972                 if($is_remote_daili){
    973                     array_push($GLOBALS['wxsync_error'],'自动代理设置失败:'.$is_remote_daili_ret);
    974                 }
    975 
    976 
    977955            }
    978956            $file = curl_exec($ch);
     
    1016994
    1017995    $GLOBALS['wxsync_article_att_ids'][] = $att_id;
    1018    
     996
    1019997    return array($ret[0],$att_id);
    1020998}
Note: See TracChangeset for help on using the changeset viewer.