Blog2Social: Social Media Auto Post & Scheduler - Version 5.1.2

Version Description

Usability Optimization

Download this release

Release Info

Developer Blog2Social
Plugin Icon 128x128 Blog2Social: Social Media Auto Post & Scheduler
Version 5.1.2
Comparing to
See all releases

Code changes from version 5.1.1 to 5.1.2

blog2social.php CHANGED
@@ -6,12 +6,12 @@
6
  * Author: Blog2Social, Adenion
7
  * Text Domain: blog2social
8
  * Domain Path: /languages
9
- * Version: 5.1.1
10
  * Author URI: https://www.blog2social.com
11
  * License: GPL2+
12
  */
13
  //B2SDefine
14
- define('B2S_PLUGIN_VERSION', '511');
15
  define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
16
  define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
17
  define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
6
  * Author: Blog2Social, Adenion
7
  * Text Domain: blog2social
8
  * Domain Path: /languages
9
+ * Version: 5.1.2
10
  * Author URI: https://www.blog2social.com
11
  * License: GPL2+
12
  */
13
  //B2SDefine
14
+ define('B2S_PLUGIN_VERSION', '512');
15
  define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
16
  define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
17
  define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
includes/B2S/Api/Post.php CHANGED
@@ -2,26 +2,19 @@
2
 
3
  class B2S_Api_Post {
4
 
5
- public static function post($url = '', $post = array(), $timeout = false) {
6
  if (empty($url) || empty($post)) {
7
  return false;
8
  }
 
 
 
 
 
 
 
9
 
10
- $ch = curl_init();
11
- curl_setopt($ch, CURLOPT_URL, $url . 'post.php');
12
- curl_setopt($ch, CURLOPT_POST, true);
13
- if ($timeout) {
14
- curl_setopt($ch, CURLOPT_TIMEOUT, 15);
15
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 18);
16
- }
17
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
18
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
19
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
20
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
21
- curl_setopt($ch, CURLOPT_CAINFO, B2S_PLUGIN_DIR . "/includes/cacert.pem");
22
- curl_setopt($ch, CURLOPT_USERAGENT, "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)");
23
- $result = curl_exec($ch);
24
- return $result;
25
  }
26
 
27
  }
2
 
3
  class B2S_Api_Post {
4
 
5
+ public static function post($url = '', $post = array(), $timeout = 30) {
6
  if (empty($url) || empty($post)) {
7
  return false;
8
  }
9
+ $args = array(
10
+ 'method' => 'POST',
11
+ 'body' => $post,
12
+ 'timeout' => $timeout,
13
+ 'redirection' => '5',
14
+ 'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)",
15
+ );
16
 
17
+ return wp_remote_retrieve_body(wp_remote_post($url . 'post.php', $args));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
  }
includes/B2S/Heartbeat.php CHANGED
@@ -62,7 +62,7 @@ class B2S_Heartbeat {
62
  $shipData = serialize($sendData);
63
  if (!empty($shipData)) {
64
  $data = array('action' => 'postSchedData', 'data' => $shipData);
65
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data));
66
  foreach ($postData as $k => $value) {
67
  if (!isset($result->content) || !isset($result->content->{$value['id']})) {
68
  $data = array('hook_action' => '1');
@@ -98,7 +98,7 @@ class B2S_Heartbeat {
98
 
99
  if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
100
  $tempData = array('action' => 'getSchedData', 'data' => serialize($sendData));
101
- $schedResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
102
  if ($schedResult->result == true) {
103
  foreach ($schedResult->content as $k => $v) {
104
  //V2
@@ -226,7 +226,7 @@ class B2S_Heartbeat {
226
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
227
  }
228
  $tempData = array('action' => 'updateUserSchedTimePost', 'data' => serialize($sendData));
229
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
230
  foreach ($sendData as $k => $value) {
231
  //is failed, try again later
232
  $id = $value['id'];
@@ -253,7 +253,7 @@ class B2S_Heartbeat {
253
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
254
  }
255
  $tempData = array('action' => 'updateUserSchedPost', 'data' => serialize($sendData));
256
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
257
  foreach ($sendData as $k => $value) {
258
  //is failed, try again later
259
  $id = $value['id'];
@@ -277,7 +277,7 @@ class B2S_Heartbeat {
277
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
278
  }
279
  $tempData = array('action' => 'deleteUserSchedPost', 'data' => serialize($sendData));
280
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
281
  foreach ($sendData as $k => $value) {
282
  //is failed, try again later
283
  $id = $value['id'];
@@ -301,7 +301,7 @@ class B2S_Heartbeat {
301
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
302
  }
303
  $tempData = array('action' => 'deleteUserPublishPost', 'data' => serialize($sendData));
304
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
305
  foreach ($sendData as $k => $value) {
306
  //is failed, try again later
307
  $id = $value['id'];
62
  $shipData = serialize($sendData);
63
  if (!empty($shipData)) {
64
  $data = array('action' => 'postSchedData', 'data' => $shipData);
65
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data),90);
66
  foreach ($postData as $k => $value) {
67
  if (!isset($result->content) || !isset($result->content->{$value['id']})) {
68
  $data = array('hook_action' => '1');
98
 
99
  if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
100
  $tempData = array('action' => 'getSchedData', 'data' => serialize($sendData));
101
+ $schedResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData,90));
102
  if ($schedResult->result == true) {
103
  foreach ($schedResult->content as $k => $v) {
104
  //V2
226
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
227
  }
228
  $tempData = array('action' => 'updateUserSchedTimePost', 'data' => serialize($sendData));
229
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData,90));
230
  foreach ($sendData as $k => $value) {
231
  //is failed, try again later
232
  $id = $value['id'];
253
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
254
  }
255
  $tempData = array('action' => 'updateUserSchedPost', 'data' => serialize($sendData));
256
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData,90));
257
  foreach ($sendData as $k => $value) {
258
  //is failed, try again later
259
  $id = $value['id'];
277
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
278
  }
279
  $tempData = array('action' => 'deleteUserSchedPost', 'data' => serialize($sendData));
280
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData,90));
281
  foreach ($sendData as $k => $value) {
282
  //is failed, try again later
283
  $id = $value['id'];
301
  $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
302
  }
303
  $tempData = array('action' => 'deleteUserPublishPost', 'data' => serialize($sendData));
304
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData,90));
305
  foreach ($sendData as $k => $value) {
306
  //is failed, try again later
307
  $id = $value['id'];
includes/B2S/Ship/Save.php CHANGED
@@ -125,7 +125,7 @@ class B2S_Ship_Save {
125
  $this->postData['action'] = 'sentToNetwork';
126
  $postData = $this->postData['post'];
127
  $this->postData['post'] = serialize($this->postData['post']);
128
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $this->postData));
129
 
130
  foreach ($postData as $k => $v) {
131
  $found = false;
125
  $this->postData['action'] = 'sentToNetwork';
126
  $postData = $this->postData['post'];
127
  $this->postData['post'] = serialize($this->postData['post']);
128
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $this->postData,90));
129
 
130
  foreach ($postData as $k => $v) {
131
  $found = false;
includes/Loader.php CHANGED
@@ -658,16 +658,13 @@ class B2S_Loader {
658
  }
659
 
660
  private function checkUpdate() {
661
- $ch = curl_init();
662
- curl_setopt($ch, CURLOPT_URL, B2S_PLUGIN_API_ENDPOINT . 'update.txt');
663
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
664
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
665
- curl_setopt($ch, CURLOPT_TIMEOUT, 15);
666
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 18);
667
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
668
- curl_setopt($ch, CURLOPT_CAINFO, B2S_PLUGIN_DIR . "/includes/cacert.pem");
669
- curl_setopt($ch, CURLOPT_USERAGENT, "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)");
670
- $currentVersion = explode('#', curl_exec($ch));
671
  if (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) {
672
  define('B2S_PLUGIN_NOTICE', 'UPDATE');
673
  }
658
  }
659
 
660
  private function checkUpdate() {
661
+ $args = array(
662
+ 'timeout' => '15',
663
+ 'redirection' => '5',
664
+ 'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)"
665
+ );
666
+ $result = wp_remote_retrieve_body(wp_remote_get(B2S_PLUGIN_API_ENDPOINT . 'update.txt', $args));
667
+ $currentVersion = explode('#', $result);
 
 
 
668
  if (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) {
669
  define('B2S_PLUGIN_NOTICE', 'UPDATE');
670
  }
includes/PRG/Api/Get.php CHANGED
@@ -2,19 +2,18 @@
2
 
3
  class PRG_Api_Get {
4
 
5
- public static function get($url = '', $header = array("Content-Type:application/x-www-form-urlencoded")) {
6
  if (empty($url)) {
7
  return false;
8
  }
9
- $ch = curl_init();
10
- curl_setopt($ch, CURLOPT_HEADER, false);
11
- curl_setopt($ch, CURLOPT_VERBOSE, true);
12
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
13
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
14
- curl_setopt($ch, CURLOPT_URL, $url);
15
- curl_setopt($ch, CURLOPT_USERAGENT, "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)");
16
- $result = curl_exec($ch);
17
- return $result;
18
  }
19
 
20
  }
2
 
3
  class PRG_Api_Get {
4
 
5
+ public static function get($url = '', $timeout = 30, $header = array("Content-Type:application/x-www-form-urlencoded")) {
6
  if (empty($url)) {
7
  return false;
8
  }
9
+
10
+ $args = array(
11
+ 'timeout' => $timeout,
12
+ 'redirection' => '5',
13
+ 'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)",
14
+ 'headers' => $header
15
+ );
16
+ return wp_remote_retrieve_body(wp_remote_get($url, $args));
 
17
  }
18
 
19
  }
includes/PRG/Api/Post.php CHANGED
@@ -2,19 +2,19 @@
2
 
3
  class PRG_Api_Post {
4
 
5
- public static function post($url = '', $post = array()) {
6
  if (empty($url) || empty($post)) {
7
  return false;
8
  }
 
 
 
 
 
 
 
9
 
10
- $ch = curl_init();
11
- curl_setopt($ch, CURLOPT_URL, $url);
12
- curl_setopt($ch, CURLOPT_POST, true);
13
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
14
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
15
- curl_setopt($ch, CURLOPT_USERAGENT, "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)");
16
- $result = curl_exec($ch);
17
- return $result;
18
  }
19
 
20
  }
2
 
3
  class PRG_Api_Post {
4
 
5
+ public static function post($url = '', $post = array(), $timeout = 30) {
6
  if (empty($url) || empty($post)) {
7
  return false;
8
  }
9
+ $args = array(
10
+ 'method' => 'POST',
11
+ 'body' => $post,
12
+ 'timeout' => $timeout,
13
+ 'redirection' => '5',
14
+ 'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)",
15
+ );
16
 
17
+ return wp_remote_retrieve_body(wp_remote_post($url, $args));
 
 
 
 
 
 
 
18
  }
19
 
20
  }
includes/Tools.php CHANGED
@@ -7,13 +7,13 @@ class B2S_Tools {
7
  }
8
 
9
  public static function getToken($data = array()) {
10
- return B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, true);
11
  }
12
 
13
  public static function setUserDetails() {
14
  delete_option('B2S_PLUGIN_USER_VERSION_' . B2S_PLUGIN_BLOG_USER_ID);
15
  delete_option('B2S_PLUGIN_PRIVACY_POLICY_USER_ACCEPT_' . B2S_PLUGIN_BLOG_USER_ID);
16
- $version = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getUserDetails', 'token' => B2S_PLUGIN_TOKEN, 'version' => B2S_PLUGIN_VERSION), true));
17
  $tokenInfo['B2S_PLUGIN_USER_VERSION'] = (isset($version->version) ? $version->version : 0);
18
  $tokenInfo['B2S_PLUGIN_VERSION'] = B2S_PLUGIN_VERSION;
19
  if (!defined("B2S_PLUGIN_USER_VERSION")) {
7
  }
8
 
9
  public static function getToken($data = array()) {
10
+ return B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30);
11
  }
12
 
13
  public static function setUserDetails() {
14
  delete_option('B2S_PLUGIN_USER_VERSION_' . B2S_PLUGIN_BLOG_USER_ID);
15
  delete_option('B2S_PLUGIN_PRIVACY_POLICY_USER_ACCEPT_' . B2S_PLUGIN_BLOG_USER_ID);
16
+ $version = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getUserDetails', 'token' => B2S_PLUGIN_TOKEN, 'version' => B2S_PLUGIN_VERSION), 30));
17
  $tokenInfo['B2S_PLUGIN_USER_VERSION'] = (isset($version->version) ? $version->version : 0);
18
  $tokenInfo['B2S_PLUGIN_VERSION'] = B2S_PLUGIN_VERSION;
19
  if (!defined("B2S_PLUGIN_USER_VERSION")) {
includes/Util.php CHANGED
@@ -128,67 +128,12 @@ class B2S_Util {
128
  }
129
 
130
  private static function b2sFileGetContents($url) {
131
- $ch = curl_init();
132
- curl_setopt($ch, CURLOPT_HEADER, 0);
133
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
134
- curl_setopt($ch, CURLOPT_URL, $url);
135
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0');
136
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
137
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
138
- $data = self::b2sCurlExecFollow($ch);
139
- curl_close($ch);
140
- return $data;
141
- }
142
-
143
- private static function b2sCurlExecFollow($ch, $maxredirect = 5) {
144
- $b2sSafeMode = ini_get('safe_mode');
145
- $b2sOpenBaseDir = ini_get('open_basedir');
146
- if ((empty($b2sOpenBaseDir) || $b2sOpenBaseDir == " ") && (filter_var($b2sSafeMode, FILTER_VALIDATE_BOOLEAN) === false) || strtolower($b2sSafeMode) == "off") {
147
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
148
- } else {
149
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
150
- if ($maxredirect > 0) {
151
- $original_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
152
- $newurl = $original_url;
153
- $rch = curl_copy_handle($ch);
154
- curl_setopt($rch, CURLOPT_HEADER, true);
155
- curl_setopt($rch, CURLOPT_NOBODY, true);
156
- curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
157
- do {
158
- curl_setopt($rch, CURLOPT_URL, $newurl);
159
- curl_setopt($rch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0');
160
- $header = curl_exec($rch);
161
- if (curl_errno($rch)) {
162
- $code = 0;
163
- } else {
164
- $code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
165
- if ((int) $code == 301) {
166
- preg_match('/Location:(.*?)\n/i', $header, $matches);
167
- $newurl = trim(array_pop($matches));
168
- if (!preg_match("/^https?:/i", $newurl)) {
169
- $newurl = $original_url . $newurl;
170
- }
171
- } else {
172
- $code = 0;
173
- }
174
- }
175
- } while ($code && --$maxredirect);
176
-
177
- curl_close($rch);
178
-
179
- if (!$maxredirect) {
180
- if ($maxredirect === null) {
181
- return false; //Too many redirects
182
- } else {
183
- $maxredirect = 0;
184
- }
185
- return false;
186
- }
187
- curl_setopt($ch, CURLOPT_URL, $newurl);
188
- }
189
- }
190
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0');
191
- return curl_exec($ch);
192
  }
193
 
194
  private static function b2sGetMetaDescription($html) {
128
  }
129
 
130
  private static function b2sFileGetContents($url) {
131
+ $args = array(
132
+ 'timeout' => '20',
133
+ 'redirection' => '5',
134
+ 'user-agent' => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0"
135
+ );
136
+ return wp_remote_retrieve_body(wp_remote_get($url, $args));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
 
139
  private static function b2sGetMetaDescription($html) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: auto post, auto publish, social media scheduling, social media calendar, s
4
  Donate link: http://www.blog2social.com
5
  Requires at least: 4.2.2
6
  Tested up to: 5.0.2
7
- Stable tag: 5.1.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -334,6 +334,8 @@ We use the official authentication oAUTH methods to third-party applications pro
334
  9. Adjust the best times to schedule in the best time scheduler.
335
 
336
  == Changelog ==
 
 
337
  = 5.1.1 =
338
  Usability Optimization, google plus instant sharing
339
  = 5.1.0 =
@@ -394,6 +396,8 @@ Usabilitiy and Performance Optimization. Select link format or image format indi
394
  Usabilitiy and Performance Optimization. NEW: Select individual images per post. Select link format or image format for your posts. Select your own time zone for scheduling posts. Emoji support.
395
 
396
  == Upgrade Notice ==
 
 
397
  = 5.1.1 =
398
  Usability Optimization, google plus instant sharing
399
  = 5.1.0 =
4
  Donate link: http://www.blog2social.com
5
  Requires at least: 4.2.2
6
  Tested up to: 5.0.2
7
+ Stable tag: 5.1.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
334
  9. Adjust the best times to schedule in the best time scheduler.
335
 
336
  == Changelog ==
337
+ = 5.1.2 =
338
+ Usability Optimization
339
  = 5.1.1 =
340
  Usability Optimization, google plus instant sharing
341
  = 5.1.0 =
396
  Usabilitiy and Performance Optimization. NEW: Select individual images per post. Select link format or image format for your posts. Select your own time zone for scheduling posts. Emoji support.
397
 
398
  == Upgrade Notice ==
399
+ = 5.1.2 =
400
+ Usability Optimization
401
  = 5.1.1 =
402
  Usability Optimization, google plus instant sharing
403
  = 5.1.0 =