Blog2Social: Social Media Auto Post & Scheduler - Version 6.1.2

Version Description

Usability Optimization

Download this release

Release Info

Developer PR-Gateway
Plugin Icon 128x128 Blog2Social: Social Media Auto Post & Scheduler
Version 6.1.2
Comparing to
See all releases

Code changes from version 6.1.1 to 6.1.2

assets/css/b2s/wp/post-box.css CHANGED
@@ -164,7 +164,6 @@
164
padding: 6px 12px;
165
text-align: center;
166
vertical-align: middle;
167
- white-space: nowrap;
168
}
169
170
.b2s-btn-margin-bottom-15{
164
padding: 6px 12px;
165
text-align: center;
166
vertical-align: middle;
167
}
168
169
.b2s-btn-margin-bottom-15{
assets/js/b2s/wp/post-box.js CHANGED
@@ -11,7 +11,7 @@ jQuery(window).on("load", function () {
11
12
//Editor Gutenberg
13
//ref https://developer.wordpress.org/block-editor/data/data-core-editor/
14
- if (wp && wp.data && wp.data.select && wp.data.subscribe) {
15
var originalModifiedDate = new Date(wp.data.select('core/editor').getCurrentPostAttribute("modified"));
16
wp.data.subscribe(function () {
17
var isAutosavingPost = wp.data.select('core/editor').isAutosavingPost();
11
12
//Editor Gutenberg
13
//ref https://developer.wordpress.org/block-editor/data/data-core-editor/
14
+ if (wp && wp.data && wp.data.select && wp.data.subscribe && wp.data.select('core/editor') != null) {
15
var originalModifiedDate = new Date(wp.data.select('core/editor').getCurrentPostAttribute("modified"));
16
wp.data.subscribe(function () {
17
var isAutosavingPost = wp.data.select('core/editor').isAutosavingPost();
blog2social.php CHANGED
@@ -6,12 +6,12 @@
6
* Author: Blog2Social, Adenion
7
* Text Domain: blog2social
8
* Domain Path: /languages
9
- * Version: 6.1.1
10
* Author URI: https://www.blog2social.com
11
* License: GPL2+
12
*/
13
14
- define('B2S_PLUGIN_VERSION', '611');
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: 6.1.2
10
* Author URI: https://www.blog2social.com
11
* License: GPL2+
12
*/
13
14
+ define('B2S_PLUGIN_VERSION', '612');
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/Heartbeat.php CHANGED
@@ -38,7 +38,11 @@ class B2S_Heartbeat {
38
public function deleteSchedPost() {
39
$this->deleteUserSchedPost();
40
}
41
-
42
private function postSchedToServer() {
43
global $wpdb;
44
$sendData = array();
38
public function deleteSchedPost() {
39
$this->deleteUserSchedPost();
40
}
41
+
42
+ public function updateSchedTimePost(){
43
+ $this->updateUserSchedTimePost();
44
+ }
45
+
46
private function postSchedToServer() {
47
global $wpdb;
48
$sendData = array();
includes/Loader.php CHANGED
@@ -194,7 +194,7 @@ class B2S_Loader {
194
include_once(B2S_PLUGIN_DIR . '/views/b2s/partials/plugin-deactivate-modal.php');
195
}
196
197
- //Insert Posts via wordpress.com (mobile app) & jetpack
198
//https://developer.jetpack.com/hooks/rest_api_inserted_post/
199
//NOTICE: jetpack call transition_post_status hook
200
/* public function b2s_auto_post_import_rest_api_jetpack($post_id, $insert, $new) {
@@ -289,7 +289,7 @@ class B2S_Loader {
289
$sched_date_utc = date('Y-m-d H:i:s', strtotime($time, strtotime($current_utc_datetime)));
290
291
$linkNoCache = $options->_getOption("link_no_cache");
292
- if($linkNoCache == false || !is_array($linkNoCache)) {
293
$fb_linkNoCache = (((int) $linkNoCache > 0) ? 1 : 0);
294
$linkNoCache = array(1 => $fb_linkNoCache, 3 => 1);
295
$options->_setOption("link_no_cache", $linkNoCache);
@@ -317,7 +317,7 @@ class B2S_Loader {
317
continue;
318
}
319
if ((int) $networkDetails[0]->network_id == 1 || (int) $networkDetails[0]->network_id == 3) {
320
- if(is_array($linkNoCache) && isset($linkNoCache[$networkDetails[0]->network_id]) && (int) $linkNoCache[$networkDetails[0]->network_id] > 0) {
321
$defaultPostData['no_cache'] = $linkNoCache[$networkDetails[0]->network_id];
322
}
323
}
@@ -435,23 +435,7 @@ class B2S_Loader {
435
if (!isset($_POST['wphb-clear-cache'])) { // WP-Hummingbird BTN clear cache - protection
436
if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
437
if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
438
-
439
- //delete scheds (don't delete, if network group changed)
440
- if(!isset($_POST['b2s-profile-selected']) || $_POST['b2s-profile-selected'] < 0 || !isset($_POST['b2s-post-meta-box-profil-dropdown']) || (int) $_POST['b2s-post-meta-box-profil-dropdown'] == (int) $_POST['b2s-profile-selected']) {
441
- global $wpdb;
442
- $getSchedData = $wpdb->prepare("SELECT b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 3, "0000-00-00 00:00:00", 0);
443
- $schedDataResult = $wpdb->get_results($getSchedData);
444
- $delete_scheds = array();
445
- foreach ($schedDataResult as $k => $value) {
446
- array_push($delete_scheds, $value->b2sPostId);
447
- }
448
- if (!empty($delete_scheds)) {
449
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
450
- B2S_Post_Tools::deleteUserSchedPost($delete_scheds);
451
- }
452
- }
453
-
454
-
455
//Gutenberg WP V5.0 - B2S V5.1.0 optimization
456
if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
457
$content = get_post((int) $_POST['post_ID']);
@@ -499,36 +483,37 @@ class B2S_Loader {
499
}
500
501
if (isset($_POST['post_ID']) && isset($_POST['user_ID']) && (int) $_POST['post_ID'] > 0 && (int) $_POST['user_ID'] > 0 && !defined("B2S_SAVE_META_BOX_AUTO_SHARE") && !wp_is_post_autosave($_POST['post_ID']) && isset($_POST['b2s-meta-box-nonce']) && wp_verify_nonce($_POST['b2s-meta-box-nonce'], 'b2s-meta-box-nonce-post-area') && isset($_POST['post_status'])) {
502
if (isset($_POST['b2s-enable-auto-post'])) {
503
if ((int) $_POST['b2s-enable-auto-post'] == 1) {
504
if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
505
$profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
506
-
507
//save network settings and besttimes if different than default
508
$postOptions = new B2S_Options($_POST['post_ID'], 'B2S_PLUGIN_POST_OPTIONS');
509
$newPostOption = $postOptions->_getOption('auto_post_manuell');
510
- if($newPostOption == false || !is_array($newPostOption)) {
511
$newPostOption = array();
512
}
513
$tempOption = array();
514
- if(isset($_POST['b2s-profile-default']) && $profilId != (int) $_POST['b2s-profile-default']) {
515
$tempOption['profile'] = $profilId;
516
} else {
517
unset($tempOption['profile']);
518
}
519
- if(isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] > 0 && isset($_POST['b2s-twitter-default']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] != (int) $_POST['b2s-twitter-default']) {
520
- $tempOption['twitter'] = (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'];
521
} else {
522
unset($tempOption['twitter']);
523
}
524
- if(isset($_POST['b2s-post-meta-box-sched-select']) && isset($_POST['b2s-best-times-default']) && (int) $_POST['b2s-post-meta-box-sched-select'] != (int) $_POST['b2s-best-times-default']) {
525
$tempOption['best_times'] = (int) $_POST['b2s-post-meta-box-sched-select'];
526
} else {
527
unset($tempOption['best_times']);
528
}
529
$newPostOption[B2S_PLUGIN_BLOG_USER_ID] = $tempOption;
530
$postOptions->_setOption('auto_post_manuell', $newPostOption);
531
-
532
if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
533
$networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
534
if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
@@ -593,7 +578,7 @@ class B2S_Loader {
593
$options = new B2S_Options((int) $_POST['user_ID']);
594
$optionPostFormat = $options->_getOption('post_template');
595
$linkNoCache = $options->_getOption("link_no_cache");
596
- if($linkNoCache == false || !is_array($linkNoCache)) {
597
$fb_linkNoCache = (((int) $linkNoCache > 0) ? 1 : 0);
598
$linkNoCache = array(1 => $fb_linkNoCache, 3 => 1);
599
$options->_setOption("link_no_cache", $linkNoCache);
@@ -619,26 +604,41 @@ class B2S_Loader {
619
$metaCard = false;
620
$tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
621
622
//TOS Twitter 032018 - none multiple Accounts - User select once
623
$selectedTwitterProfile = (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && !empty($_POST['b2s-post-meta-box-profil-dropdown-twitter'])) ? (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] : '';
624
foreach ($networkData as $k => $value) {
625
if ((int) $value->networkId == 1 || (int) $value->networkId == 3) {
626
- if(is_array($linkNoCache) && isset($linkNoCache[$value->networkId]) && (int) $linkNoCache[$value->networkId] > 0) {
627
$defaultPostData['no_cache'] = $linkNoCache[$value->networkId];
628
}
629
}
630
if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
631
//TOS Twitter 032018 - none multiple Accounts - User select once
632
if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
633
-
634
//TOS Crossposting ignore
635
//Filter: TOS Crossposting ignore
636
if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
637
continue;
638
}
639
-
640
$res = $autoShare->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType);
641
if ($res !== false && is_array($res)) {
642
$res = array_merge($res, $defaultPostData);
643
$shareApprove = (isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0;
644
$autoShare->saveShareData($res, $value->networkId, $value->networkType, $value->networkAuthId, $shareApprove, strip_tags($value->networkUserName));
@@ -663,18 +663,23 @@ class B2S_Loader {
663
$meta->updateMeta((int) $_POST['post_ID']);
664
}
665
}
666
- //END MetaTags
667
}
668
}
669
}
670
}
671
if ($sched_type != 3) {
672
if (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) {
673
$dateFormat = ($_POST['b2s-user-lang'] == 'de') ? 'd.m.Y' : 'Y-m-d';
674
$_POST['b2s_update_publish_date'] = date($dateFormat, strtotime($sched_date));
675
}
676
}
677
-
678
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
679
}
680
} else {
@@ -686,17 +691,17 @@ class B2S_Loader {
686
}
687
}
688
}
689
- } elseif(isset($_POST['post_status']) && strtolower($_POST['post_status']) == "future") {
690
//update existing posts, if shed date before future date
691
$user_timezone = isset($_POST['b2s-user-timezone']) ? (int) $_POST['b2s-user-timezone'] : 0;
692
$current_utc_date = gmdate('Y-m-d H:i:s');
693
$current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
694
-
695
$post_date = '';
696
if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
697
$post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
698
}
699
-
700
if (empty($post_date)) {
701
if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
702
$wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
@@ -706,19 +711,24 @@ class B2S_Loader {
706
}
707
$post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
708
}
709
-
710
$sched_date = date('Y-m-d H:i:59', strtotime($post_date));
711
$sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
712
-
713
global $wpdb;
714
$getSchedData = $wpdb->prepare("SELECT b.sched_date_utc, b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 2, "0000-00-00 00:00:00", 0);
715
$schedDataResult = $wpdb->get_results($getSchedData);
716
foreach ($schedDataResult as $k => $value) {
717
- if($value->sched_date_utc <= $sched_date_utc) {
718
require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
719
B2S_Post_Tools::updateUserSchedTimePost($value->b2sPostId, substr($sched_date, 0, 10), substr($sched_date, 11), $user_timezone);
720
}
721
}
722
}
723
}
724
}
@@ -1617,7 +1627,7 @@ class B2S_Loader {
1617
PRIMARY KEY (`id`)
1618
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
1619
$wpdb->query($sqlCreateUserNetworkDetails);
1620
-
1621
//since 6.1.0 add settings
1622
$b2sNetworkDetailsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_network_details');
1623
if (is_array($b2sNetworkDetailsCols) && isset($b2sNetworkDetailsCols[0])) {
@@ -1677,7 +1687,7 @@ class B2S_Loader {
1677
INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
1678
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
1679
$wpdb->query($sqlCreateDrafts);
1680
-
1681
//since V6.1.0
1682
$b2sPostsDraftsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_drafts');
1683
if (is_array($b2sPostsDraftsCols) && isset($b2sPostsDraftsCols[0])) {
@@ -1688,7 +1698,7 @@ class B2S_Loader {
1688
}
1689
}
1690
if (!in_array("save_origin", $b2sPostsDraftsColsData)) {
1691
- $wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts_drafts ADD save_origin TINYINT NOT NULL DEFAULT 0");
1692
}
1693
}
1694
194
include_once(B2S_PLUGIN_DIR . '/views/b2s/partials/plugin-deactivate-modal.php');
195
}
196
197
+ //Insert Posts via wordpress.com (mobile app) & jetpack
198
//https://developer.jetpack.com/hooks/rest_api_inserted_post/
199
//NOTICE: jetpack call transition_post_status hook
200
/* public function b2s_auto_post_import_rest_api_jetpack($post_id, $insert, $new) {
289
$sched_date_utc = date('Y-m-d H:i:s', strtotime($time, strtotime($current_utc_datetime)));
290
291
$linkNoCache = $options->_getOption("link_no_cache");
292
+ if ($linkNoCache == false || !is_array($linkNoCache)) {
293
$fb_linkNoCache = (((int) $linkNoCache > 0) ? 1 : 0);
294
$linkNoCache = array(1 => $fb_linkNoCache, 3 => 1);
295
$options->_setOption("link_no_cache", $linkNoCache);
317
continue;
318
}
319
if ((int) $networkDetails[0]->network_id == 1 || (int) $networkDetails[0]->network_id == 3) {
320
+ if (is_array($linkNoCache) && isset($linkNoCache[$networkDetails[0]->network_id]) && (int) $linkNoCache[$networkDetails[0]->network_id] > 0) {
321
$defaultPostData['no_cache'] = $linkNoCache[$networkDetails[0]->network_id];
322
}
323
}
435
if (!isset($_POST['wphb-clear-cache'])) { // WP-Hummingbird BTN clear cache - protection
436
if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
437
if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
438
+
439
//Gutenberg WP V5.0 - B2S V5.1.0 optimization
440
if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
441
$content = get_post((int) $_POST['post_ID']);
483
}
484
485
if (isset($_POST['post_ID']) && isset($_POST['user_ID']) && (int) $_POST['post_ID'] > 0 && (int) $_POST['user_ID'] > 0 && !defined("B2S_SAVE_META_BOX_AUTO_SHARE") && !wp_is_post_autosave($_POST['post_ID']) && isset($_POST['b2s-meta-box-nonce']) && wp_verify_nonce($_POST['b2s-meta-box-nonce'], 'b2s-meta-box-nonce-post-area') && isset($_POST['post_status'])) {
486
+ $ship = false;
487
if (isset($_POST['b2s-enable-auto-post'])) {
488
if ((int) $_POST['b2s-enable-auto-post'] == 1) {
489
if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
490
$profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
491
+
492
//save network settings and besttimes if different than default
493
$postOptions = new B2S_Options($_POST['post_ID'], 'B2S_PLUGIN_POST_OPTIONS');
494
$newPostOption = $postOptions->_getOption('auto_post_manuell');
495
+ if ($newPostOption == false || !is_array($newPostOption)) {
496
$newPostOption = array();
497
}
498
$tempOption = array();
499
+ if (isset($_POST['b2s-profile-default']) && $profilId != (int) $_POST['b2s-profile-default']) {
500
$tempOption['profile'] = $profilId;
501
} else {
502
unset($tempOption['profile']);
503
}
504
+ if (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] > 0 && isset($_POST['b2s-twitter-default']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] != (int) $_POST['b2s-twitter-default']) {
505
+ $tempOption['twitter'] = (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'];
506
} else {
507
unset($tempOption['twitter']);
508
}
509
+ if (isset($_POST['b2s-post-meta-box-sched-select']) && isset($_POST['b2s-best-times-default']) && (int) $_POST['b2s-post-meta-box-sched-select'] != (int) $_POST['b2s-best-times-default']) {
510
$tempOption['best_times'] = (int) $_POST['b2s-post-meta-box-sched-select'];
511
} else {
512
unset($tempOption['best_times']);
513
}
514
$newPostOption[B2S_PLUGIN_BLOG_USER_ID] = $tempOption;
515
$postOptions->_setOption('auto_post_manuell', $newPostOption);
516
+
517
if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
518
$networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
519
if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
578
$options = new B2S_Options((int) $_POST['user_ID']);
579
$optionPostFormat = $options->_getOption('post_template');
580
$linkNoCache = $options->_getOption("link_no_cache");
581
+ if ($linkNoCache == false || !is_array($linkNoCache)) {
582
$fb_linkNoCache = (((int) $linkNoCache > 0) ? 1 : 0);
583
$linkNoCache = array(1 => $fb_linkNoCache, 3 => 1);
584
$options->_setOption("link_no_cache", $linkNoCache);
604
$metaCard = false;
605
$tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
606
607
+ //Delete old sched posts (don't delete, if network group changed)
608
+ if (!isset($_POST['b2s-profile-selected']) || $_POST['b2s-profile-selected'] < 0 || !isset($_POST['b2s-post-meta-box-profil-dropdown']) || (int) $_POST['b2s-post-meta-box-profil-dropdown'] == (int) $_POST['b2s-profile-selected']) {
609
+ global $wpdb;
610
+ $getSchedData = $wpdb->prepare("SELECT b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 3, "0000-00-00 00:00:00", 0);
611
+ $schedDataResult = $wpdb->get_results($getSchedData);
612
+ $delete_scheds = array();
613
+ foreach ($schedDataResult as $k => $value) {
614
+ array_push($delete_scheds, $value->b2sPostId);
615
+ }
616
+ if (!empty($delete_scheds)) {
617
+ require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
618
+ $ship = true;
619
+ B2S_Post_Tools::deleteUserSchedPost($delete_scheds);
620
+ }
621
+ }
622
+
623
//TOS Twitter 032018 - none multiple Accounts - User select once
624
$selectedTwitterProfile = (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && !empty($_POST['b2s-post-meta-box-profil-dropdown-twitter'])) ? (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] : '';
625
foreach ($networkData as $k => $value) {
626
if ((int) $value->networkId == 1 || (int) $value->networkId == 3) {
627
+ if (is_array($linkNoCache) && isset($linkNoCache[$value->networkId]) && (int) $linkNoCache[$value->networkId] > 0) {
628
$defaultPostData['no_cache'] = $linkNoCache[$value->networkId];
629
}
630
}
631
if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
632
//TOS Twitter 032018 - none multiple Accounts - User select once
633
if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
634
//TOS Crossposting ignore
635
//Filter: TOS Crossposting ignore
636
if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
637
continue;
638
}
639
$res = $autoShare->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType);
640
if ($res !== false && is_array($res)) {
641
+ $ship = true;
642
$res = array_merge($res, $defaultPostData);
643
$shareApprove = (isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0;
644
$autoShare->saveShareData($res, $value->networkId, $value->networkType, $value->networkAuthId, $shareApprove, strip_tags($value->networkUserName));
663
$meta->updateMeta((int) $_POST['post_ID']);
664
}
665
}
666
+ //END MetaTags
667
}
668
}
669
}
670
}
671
+ if ($ship) {
672
+ B2S_Heartbeat::getInstance()->deleteSchedPost();
673
+ B2S_Heartbeat::getInstance()->postToServer();
674
+ }
675
+
676
if ($sched_type != 3) {
677
if (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) {
678
$dateFormat = ($_POST['b2s-user-lang'] == 'de') ? 'd.m.Y' : 'Y-m-d';
679
$_POST['b2s_update_publish_date'] = date($dateFormat, strtotime($sched_date));
680
}
681
}
682
+
683
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
684
}
685
} else {
691
}
692
}
693
}
694
+ } else if (isset($_POST['post_status']) && strtolower($_POST['post_status']) == "future") {
695
//update existing posts, if shed date before future date
696
$user_timezone = isset($_POST['b2s-user-timezone']) ? (int) $_POST['b2s-user-timezone'] : 0;
697
$current_utc_date = gmdate('Y-m-d H:i:s');
698
$current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
699
+
700
$post_date = '';
701
if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
702
$post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
703
}
704
+
705
if (empty($post_date)) {
706
if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
707
$wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
711
}
712
$post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
713
}
714
+
715
$sched_date = date('Y-m-d H:i:59', strtotime($post_date));
716
$sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
717
+
718
global $wpdb;
719
$getSchedData = $wpdb->prepare("SELECT b.sched_date_utc, b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 2, "0000-00-00 00:00:00", 0);
720
$schedDataResult = $wpdb->get_results($getSchedData);
721
foreach ($schedDataResult as $k => $value) {
722
+ if ($value->sched_date_utc <= $sched_date_utc) {
723
+ $ship = true;
724
require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
725
B2S_Post_Tools::updateUserSchedTimePost($value->b2sPostId, substr($sched_date, 0, 10), substr($sched_date, 11), $user_timezone);
726
}
727
}
728
+
729
+ if ($ship) {
730
+ B2S_Heartbeat::getInstance()->updateSchedTimePost();
731
+ }
732
}
733
}
734
}
1627
PRIMARY KEY (`id`)
1628
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
1629
$wpdb->query($sqlCreateUserNetworkDetails);
1630
+
1631
//since 6.1.0 add settings
1632
$b2sNetworkDetailsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_network_details');
1633
if (is_array($b2sNetworkDetailsCols) && isset($b2sNetworkDetailsCols[0])) {
1687
INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
1688
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
1689
$wpdb->query($sqlCreateDrafts);
1690
+
1691
//since V6.1.0
1692
$b2sPostsDraftsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_drafts');
1693
if (is_array($b2sPostsDraftsCols) && isset($b2sPostsDraftsCols[0])) {
1698
}
1699
}
1700
if (!in_array("save_origin", $b2sPostsDraftsColsData)) {
1701
+ $wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts_drafts ADD save_origin TINYINT NOT NULL DEFAULT '0'");
1702
}
1703
}
1704
includes/Meta.php CHANGED
@@ -168,7 +168,9 @@ class B2S_Meta {
168
$url = home_url();
169
if (!is_home()) {
170
$parts = parse_url($url);
171
- $url = $parts['scheme'] . '://' . $parts['host'] . $_SERVER['REQUEST_URI'];
172
}
173
echo '<meta property="og:url" content="' . esc_url(apply_filters('b2s_og_meta_url', $url)) . '"/>' . "\n";
174
}
168
$url = home_url();
169
if (!is_home()) {
170
$parts = parse_url($url);
171
+ if (is_array($parts) && isset($parts['scheme']) && isset($parts['host'])) {
172
+ $url = $parts['scheme'] . '://' . $parts['host'] . $_SERVER['REQUEST_URI'];
173
+ }
174
}
175
echo '<meta property="og:url" content="' . esc_url(apply_filters('b2s_og_meta_url', $url)) . '"/>' . "\n";
176
}
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: auto post, auto publish, social media scheduling, social media calendar, s
5
Donate link: https://paypal.me/adenion
6
Requires at least: 4.7.0
7
Tested up to: 5.3
8
- Stable tag: 6.1.1
9
License: GPLv3
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -213,6 +213,8 @@ To get started with the basics of Blog2Social and maybe find some useful tips an
213
7. Keep track of your shared posts and scheduling plan with the Social Media Calendar.
214
215
== Changelog ==
216
= 6.1.1 =
217
Usability Optimization
218
= 6.1.0 =
@@ -267,6 +269,8 @@ Usability Optimization
267
Content Curation with links, WooCommerce compatibility, gutenberg editor compatibility
268
269
== Upgrade Notice ==
270
= 6.1.1 =
271
Usability Optimization
272
= 6.1.0 =
5
Donate link: https://paypal.me/adenion
6
Requires at least: 4.7.0
7
Tested up to: 5.3
8
+ Stable tag: 6.1.2
9
License: GPLv3
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
213
7. Keep track of your shared posts and scheduling plan with the Social Media Calendar.
214
215
== Changelog ==
216
+ = 6.1.2 =
217
+ Usability Optimization
218
= 6.1.1 =
219
Usability Optimization
220
= 6.1.0 =
269
Content Curation with links, WooCommerce compatibility, gutenberg editor compatibility
270
271
== Upgrade Notice ==
272
+ = 6.1.2 =
273
+ Usability Optimization
274
= 6.1.1 =
275
Usability Optimization
276
= 6.1.0 =