Changeset 2757419
- Timestamp:
- 07/16/2022 04:28:31 PM (4 years ago)
- Location:
- social-networks-auto-poster-facebook-twitter-g/trunk
- Files:
-
- 5 edited
-
NextScripts_SNAP.php (modified) (2 diffs)
-
inc-cl/tw.api.php (modified) (2 diffs)
-
inc/nxs_functions.php (modified) (2 diffs)
-
inc/nxs_functions_wp.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
social-networks-auto-poster-facebook-twitter-g/trunk/NextScripts_SNAP.php
r2757212 r2757419 5 5 Description: This plugin automatically publishes posts from your blog to your social media accounts on Twitter, FB, Telegram, LinkedIn, and 25 more networks. 6 6 Author: NextScripts 7 Version: 4.3.2 77 Version: 4.3.28 8 8 Author URI: https://www.nextscripts.com 9 9 Text Domain: social-networks-auto-poster-facebook-twitter-g … … 11 11 */ 12 12 13 define( 'NextScripts_SNAP_Version' , '4.3.2 7' ); define( 'NextScripts_SNAP_Version_Date' , 'July 15, 2022' ); require_once "inc/nxs_functions_wp.php"; if(!defined( 'NXSSNAP_BASENAME' ) ) define( 'NXSSNAP_BASENAME', plugin_basename( __FILE__ ) );13 define( 'NextScripts_SNAP_Version' , '4.3.28' ); define( 'NextScripts_SNAP_Version_Date' , 'July 16, 2022' ); require_once "inc/nxs_functions_wp.php"; if(!defined( 'NXSSNAP_BASENAME' ) ) define( 'NXSSNAP_BASENAME', plugin_basename( __FILE__ ) ); 14 14 15 15 if (true===nxs_doSystemInitCheck()) { // error_reporting(E_ALL); ini_set('display_errors', '1'); -
social-networks-auto-poster-facebook-twitter-g/trunk/inc-cl/tw.api.php
r2757212 r2757419 48 48 //## Fallback in case no mo imgs allowed. 49 49 if ($code == '403' && stripos($resp, 'User is over daily photo limit') !== false && $options['attchImg'] != false && $img != '') { 50 $badOut['Error'] .= "User is over daily photo limit. Will post without image\r\n";50 $badOut['Error'] = $badOut['Error']." User is over daily photo limit. Will post without image\r\n"; 51 51 $ret = $appi->twReq('https://api.twitter.com/2/tweets', array('text' => $msg)); 52 52 $code = $ret['response']['code']; $resp = $ret['body']; $respJ = json_decode($resp, true); … … 61 61 return array('postID' => $twNewPostID, 'isPosted' => 1, 'postURL' => 'https://twitter.com/' . $twPageID . '/status/' . $twNewPostID, 'pDate' => date('Y-m-d H:i:s')); 62 62 } else { 63 $badOut['Error'] .= "Resp: " . print_r($resp, true) . "| Error: " . print_r($respJ['errors'], true) . "| MSG: " . print_r($msg, true); 63 $je = (is_array($respJ) && !empty($respJ['errors']))?"| Error: " . print_r($respJ['errors'], true):''; 64 $badOut['Error'] = $badOut['Error'] . "| Resp: " . print_r($resp, true) . $je . "| MSG: " . print_r($msg, true); 64 65 return $badOut; 65 66 } -
social-networks-auto-poster-facebook-twitter-g/trunk/inc/nxs_functions.php
r2757212 r2757419 60 60 61 61 //## Upload image as file from URL to remote server 62 if (!function_exists('nxs_altCurlUploadImg')){ function nxs_altCurlUploadImg( $ch, $r ){ $pstArray = unserialize($r['headers']['nxsPstArr']); $tmp = $r['headers']['nxsUplFile']; $fld = $r['headers']['nxsPstField'];63 unset($r['headers']['nxsPstArr']); unset($r['headers']['nxsUplFile']); unset($r['headers']['nxsPstField']);64 if (function_exists('curl_file_create')) $file = curl_file_create($tmp); else $file = '@'.$tmp; $pstArray[$fld] = $file; $r['body'] = http_build_query($pstArray);65 if ( !empty( $r['headers'] ) ) { $headers = array(); foreach ( $r['headers'] as $name => $value ) if ($name!=='Content-Length') $headers[] = "{$name}: $value"; curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );}66 curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $pstArray); return array('ch'=>$ch, 'r'=>$r);67 }}68 62 if (!function_exists('nxs_curlUploadImg')){ function nxs_curlUploadImg($imgURL, $uplURL, $pstArray, $pstField, $ck='') { $remImgURL = urldecode($imgURL); $urlParced = pathinfo($remImgURL); $remImgURLFilename = $urlParced['basename']; 69 $imgType = substr( $remImgURL, strrpos( $remImgURL , '.' )+1 ); if (stripos($imgType,'?')!==false) $imgType = @reset((explode('?', $imgType))); $ia = array("jpg", "png", "gif", "jpeg"); if (!in_array($imgType, $ia)) $imgType = 'jpg'; 63 $imgType = substr( $remImgURL, strrpos( $remImgURL , '.' )+1 ); if (stripos($imgType,'?')!==false) { $itt = explode('?', $imgType); $imgType = @reset($itt); } 64 $ia = array("jpg", "png", "gif", "jpeg"); if (!in_array($imgType, $ia)) $imgType = 'jpg'; 70 65 $hdrsArr = array('User-Agent'=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 'Referer'=>$remImgURL); 71 66 $advSet = nxs_mkRemOptsArr($hdrsArr); $imgData = nxs_remote_get($remImgURL, $advSet);// prr($remImgURL); // prr($imgData); … … 76 71 if (function_exists('wp_upload_dir')) { $uDir = wp_upload_dir(); $tmpX = tempnam($uDir['path'], "nx"); if (!is_writable($tmpX)) return $msg." Your UPLOADS folder or file (file - ".$tmpX.") is not writable. ";} else return $msg; 77 72 } rename($tmpX, $tmpX.='.'.$imgType); register_shutdown_function('unlink', $tmpX); file_put_contents($tmpX, $imgData); 78 $hdrsArr['Content-type'] = 'multipart/form-data'; $hdrsArr['nxsUplFile'] = $tmpX; $hdrsArr['nxsPstArr'] = serialize($pstArray); $hdrsArr['nxsPstField'] = $pstField; $advSet = nxs_mkRemOptsArr($hdrsArr, $ck, $pstArray); $advSet['postAsArray'] = 1; //prr($advSet); 79 $rep = nxs_remote_post($uplURL, $advSet); @unlink($tmpX); if(is_nxs_error($rep)) return array('err'=>print_r($rep, true)); else return $rep; 73 if (function_exists('curl_file_create')) { $file = curl_file_create($tmpX); $pstArray[$pstField] = $file; } else $pstArray[$pstField] = '@' . $tmpX; 74 $argArr['extraHeaders']['Content-Type'] = 'multipart/form-data'; 75 $argArr['flds'] = $pstArray; $rq = new nxsHttp; $args = nxs_mkRmReqArgs($argArr); $rq->postData = $pstArray;// prr($args); 76 $rep = $rq->request($uplURL, $args); @unlink($tmpX); if(is_nxs_error($rep)) return array('err'=>print_r($rep, true)); else return $rep; 80 77 }} 81 78 if (!function_exists("nxs_add_array_sort")) { function nxs_add_array_sort($a, $b){ $c = array('Social Networks'=>1, 'Blogs/Publishing Platforms'=>2, 'Link Sharing/Boormarks'=>3, 'Email Marketing'=>4, 'Messengers'=>5, 'Image Sharing'=>6, 'Forums'=>7, 'Other'=>8); -
social-networks-auto-poster-facebook-twitter-g/trunk/inc/nxs_functions_wp.php
r2757212 r2757419 171 171 } 172 172 } 173 174 add_action('wp_head', 'jsPostToFAV'); add_action( 'wp_footer', 'nxsFavFooter' ); 175 173 176 //## [Posts to Favorite Accounts] Add JS and CSS 174 add_action('wp_head', 'jsPostToFAV'); 175 if (!function_exists("jsPostToFAV")) { function jsPostToFAV(){ ?> 177 if (!function_exists("jsPostToFAV")) { function jsPostToFAV(){ if( current_user_can('editor') || current_user_can('administrator') ) { ?> 176 178 <script type="text/javascript"> 177 179 function nxsPostToFav(obj){ obj.preventDefault; … … 186 188 wp_enqueue_script( 'modal', $path . '/js-css/jquery.modal.min.js', array( 'jquery' ), NextScripts_SNAP_Version, true); 187 189 wp_enqueue_style( 'modal', $path . '/js-css/jquery.modal.min.css', array( ), NextScripts_SNAP_Version ); 188 }} 190 }}} 189 191 //## [Posts to Favorite Accounts] Div to Footer Posts to Favorite Accounts modal msg results. 190 add_action( 'wp_footer', 'nxsFavFooter' ); 191 if (!function_exists("nxsFavFooter")) { function nxsFavFooter() { echo '<div style="display: none;" id="nxsFavNotice"><div id="nxsFavNoticeCnt">Posting....</div></div>'; }} 192 if (!function_exists("nxsFavFooter")) { function nxsFavFooter() { if( current_user_can('editor') || current_user_can('administrator') ) { echo '<div style="display: none;" id="nxsFavNotice"><div id="nxsFavNoticeCnt">Posting....</div></div>'; }}} 192 193 193 194 -
social-networks-auto-poster-facebook-twitter-g/trunk/readme.txt
r2757212 r2757419 6 6 Requires at least: 3.4 7 7 Tested up to: 6.0.1 8 Stable tag: 4.3.2 78 Stable tag: 4.3.28 9 9 License: GPLv2 or later 10 10 … … 183 183 == Changelog == 184 184 185 = 4.3.28 [07/15/2022] = 186 187 * Bug Fix - [ok.ru] - Image upload error fix. 188 * Bug Fix - fix for "Cannot use assign-op operators with string offsets" error. 189 * Bug Fix - "Post to Favorite Accounts" code shown only to admins. 190 185 191 = 4.3.27 [07/15/2022] = 186 192
Note: See TracChangeset
for help on using the changeset viewer.