Plugin Directory

Changeset 2757419


Ignore:
Timestamp:
07/16/2022 04:28:31 PM (4 years ago)
Author:
NextScripts
Message:

Version 4.3.28

Location:
social-networks-auto-poster-facebook-twitter-g/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • social-networks-auto-poster-facebook-twitter-g/trunk/NextScripts_SNAP.php

    r2757212 r2757419  
    55Description: This plugin automatically publishes posts from your blog to your social media accounts on Twitter, FB, Telegram, LinkedIn, and 25 more networks.
    66Author: NextScripts
    7 Version: 4.3.27
     7Version: 4.3.28
    88Author URI: https://www.nextscripts.com
    99Text Domain: social-networks-auto-poster-facebook-twitter-g
     
    1111*/
    1212
    13 define( 'NextScripts_SNAP_Version' , '4.3.27' ); 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__ ) );
     13define( '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__ ) );
    1414
    1515if (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  
    4848            //## Fallback in case no mo imgs allowed.
    4949            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";
    5151                $ret = $appi->twReq('https://api.twitter.com/2/tweets', array('text' => $msg));
    5252                $code = $ret['response']['code']; $resp = $ret['body']; $respJ = json_decode($resp, true);
     
    6161                return array('postID' => $twNewPostID, 'isPosted' => 1, 'postURL' => 'https://twitter.com/' . $twPageID . '/status/' . $twNewPostID, 'pDate' => date('Y-m-d H:i:s'));
    6262            } 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);
    6465                return $badOut;
    6566            }
  • social-networks-auto-poster-facebook-twitter-g/trunk/inc/nxs_functions.php

    r2757212 r2757419  
    6060
    6161//## 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 }}
    6862if (!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';
    7065  $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);
    7166  $advSet = nxs_mkRemOptsArr($hdrsArr);  $imgData = nxs_remote_get($remImgURL, $advSet);// prr($remImgURL);  // prr($imgData);
     
    7671    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;
    7772  } 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;
    8077}}
    8178if (!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  
    171171    }
    172172}
     173
     174add_action('wp_head', 'jsPostToFAV'); add_action( 'wp_footer', 'nxsFavFooter' );
     175
    173176//## [Posts to Favorite Accounts] Add JS and CSS
    174 add_action('wp_head', 'jsPostToFAV');
    175 if (!function_exists("jsPostToFAV")) { function jsPostToFAV(){ ?>
     177if (!function_exists("jsPostToFAV")) { function jsPostToFAV(){ if( current_user_can('editor') || current_user_can('administrator') ) { ?>
    176178    <script type="text/javascript">
    177179        function nxsPostToFav(obj){ obj.preventDefault;
     
    186188    wp_enqueue_script( 'modal', $path . '/js-css/jquery.modal.min.js', array( 'jquery' ),  NextScripts_SNAP_Version, true);
    187189    wp_enqueue_style( 'modal',  $path . '/js-css/jquery.modal.min.css', array( ),  NextScripts_SNAP_Version );
    188 }}
     190}}}
    189191//## [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>'; }}
     192if (!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>'; }}}
    192193
    193194
  • social-networks-auto-poster-facebook-twitter-g/trunk/readme.txt

    r2757212 r2757419  
    66Requires at least: 3.4
    77Tested up to: 6.0.1
    8 Stable tag: 4.3.27
     8Stable tag: 4.3.28
    99License: GPLv2 or later
    1010
     
    183183== Changelog ==
    184184
     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
    185191= 4.3.27 [07/15/2022] =
    186192
Note: See TracChangeset for help on using the changeset viewer.