Blog2Social: Social Media Auto Post & Scheduler - Version 3.7.0

Version Description

New Network: Reddit and Facebook groups. Emoji and shortcode support added. Usabilitiy and Performance Optimization.

Download this release

Release Info

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

Code changes from version 3.1.3 to 3.7.0

Files changed (44) hide show
  1. assets/css/b2s/post.publish.css +4 -0
  2. assets/css/b2s/post.sched.css +4 -0
  3. assets/css/b2s/ship.css +1 -1
  4. assets/css/b2s/wp/post-meta-box.css +0 -4
  5. assets/css/general.css +8 -0
  6. assets/images/portale/15_flat.png +0 -0
  7. assets/images/settings/b2s-post-format-1-1-de-info.png +0 -0
  8. assets/images/settings/b2s-post-format-1-1-en-info.png +0 -0
  9. assets/images/settings/b2s-post-format-1-2-de-info.png +0 -0
  10. assets/images/settings/b2s-post-format-1-2-en-info.png +0 -0
  11. assets/js/b2s/post.js +1 -1
  12. assets/js/b2s/settings.js +47 -0
  13. assets/js/b2s/ship.js +29 -4
  14. assets/js/b2s/wp/post-meta-box.js +4 -2
  15. includes/Ajax/Get.php +2 -1
  16. includes/Ajax/Post.php +12 -1
  17. includes/AutoShare.php +11 -8
  18. includes/B2S/Api/Post.php +1 -0
  19. includes/B2S/Heartbeat.php +2 -2
  20. includes/B2S/Network/Item.php +4 -4
  21. includes/B2S/Post/Filter.php +1 -1
  22. includes/B2S/Post/Item.php +28 -20
  23. includes/B2S/Settings/Item.php +10 -7
  24. includes/B2S/Ship/Image.php +3 -8
  25. includes/B2S/Ship/Item.php +60 -43
  26. includes/B2S/Ship/Navbar.php +1 -1
  27. includes/B2S/Ship/Save.php +13 -1
  28. includes/Init.php +87 -58
  29. includes/MetaBox.php +5 -4
  30. includes/PRG/Api/Get.php +1 -0
  31. includes/PRG/Api/Post.php +1 -0
  32. includes/PRG/Ship/Image.php +3 -9
  33. includes/PRG/Ship/Item.php +2 -9
  34. includes/Util.php +68 -22
  35. index.php +24 -4
  36. languages/blog2social-de_DE.mo +0 -0
  37. languages/blog2social-de_DE.po +365 -260
  38. languages/blog2social-fr_FR.mo +0 -0
  39. languages/blog2social-fr_FR.po +721 -611
  40. readme.txt +51 -28
  41. views/b2s/html/footer.phtml +2 -2
  42. views/b2s/settings.php +34 -13
  43. views/b2s/ship.php +49 -2
  44. views/prg/ship.php +8 -5
assets/css/b2s/post.publish.css CHANGED
@@ -59,4 +59,8 @@
59
60
.b2s-loading-area{
61
width: 100% !important;
62
}
59
60
.b2s-loading-area{
61
width: 100% !important;
62
+ }
63
+ .checbox-item-empty{
64
+ padding: 15px;
65
+ float:left;
66
}
assets/css/b2s/post.sched.css CHANGED
@@ -111,4 +111,8 @@
111
}
112
.b2s-loading-area{
113
width: 100% !important;
114
}
111
}
112
.b2s-loading-area{
113
width: 100% !important;
114
+ }
115
+ .checbox-item-empty{
116
+ padding: 15px;
117
+ float:left;
118
}
assets/css/b2s/ship.css CHANGED
@@ -307,7 +307,7 @@
307
width: 100% !important;
308
}
309
310
- .b2s-post-ship-item-full-text, .b2s-post-ship-item-message-delete{
311
line-height: 1.5 !important;
312
padding: 0 1px 4px !important;
313
}
307
width: 100% !important;
308
}
309
310
+ .b2s-post-ship-item-full-text, .b2s-post-ship-item-message-delete, .b2s-post-ship-item-network-settings{
311
line-height: 1.5 !important;
312
padding: 0 1px 4px !important;
313
}
assets/css/b2s/wp/post-meta-box.css CHANGED
@@ -40,10 +40,6 @@
40
.b2s-info-warning{
41
border: 1px solid orange;
42
}
43
- .b2s-color-green{
44
- color: green;
45
- font-weight: 600;
46
- }
47
.b2s-meta-box-headline{
48
margin: 0.55em 0 !important;
49
font-size: 1.08em !important;
40
.b2s-info-warning{
41
border: 1px solid orange;
42
}
43
.b2s-meta-box-headline{
44
margin: 0.55em 0 !important;
45
font-size: 1.08em !important;
assets/css/general.css CHANGED
@@ -7073,4 +7073,12 @@ input[type="checkbox"].error + label{
7073
7074
.b2s-loader-text{
7075
font-size: 50%;
7076
}
7073
7074
.b2s-loader-text{
7075
font-size: 50%;
7076
+ }
7077
+
7078
+ .clearfix{
7079
+ display: block !important;
7080
+ }
7081
+
7082
+ .b2s-color-green{
7083
+ color: #79b232;
7084
}
assets/images/portale/15_flat.png ADDED
Binary file
assets/images/settings/b2s-post-format-1-1-de-info.png ADDED
Binary file
assets/images/settings/b2s-post-format-1-1-en-info.png ADDED
Binary file
assets/images/settings/b2s-post-format-1-2-de-info.png ADDED
Binary file
assets/images/settings/b2s-post-format-1-2-en-info.png ADDED
Binary file
assets/js/b2s/post.js CHANGED
@@ -370,7 +370,7 @@ if (jQuery.isFunction(jQuery.fn.datepicker)) {
370
}
371
if (jQuery.isFunction(jQuery.fn.timepicker)) {
372
jQuery('#b2s-change-time').timepicker({
373
- minuteStep: 30,
374
appendWidgetTo: 'body',
375
showSeconds: false,
376
showMeridian: showMeridian,
370
}
371
if (jQuery.isFunction(jQuery.fn.timepicker)) {
372
jQuery('#b2s-change-time').timepicker({
373
+ minuteStep: 15,
374
appendWidgetTo: 'body',
375
showSeconds: false,
376
showMeridian: showMeridian,
assets/js/b2s/settings.js CHANGED
@@ -12,6 +12,12 @@ jQuery(window).on("load", function () {
12
showMeridian: showMeridian,
13
defaultTime: 'current'
14
});
15
});
16
jQuery(document).on('click', '.b2s-save-settings-pro-info', function () {
17
return false;
@@ -136,6 +142,47 @@ jQuery(document).on('click', '#b2s-user-network-settings-auto-share', function (
136
});
137
138
139
jQuery(document).on('change', '.b2s-user-network-settings-post-format', function () {
140
jQuery('.b2s-settings-user-success').hide();
141
jQuery('.b2s-settings-user-error').hide();
12
showMeridian: showMeridian,
13
defaultTime: 'current'
14
});
15
+
16
+ var b2sShowSection = jQuery('#b2sShowSection').val();
17
+ if(b2sShowSection != ""){
18
+ jQuery("."+b2sShowSection).trigger("click");
19
+ }
20
+
21
});
22
jQuery(document).on('click', '.b2s-save-settings-pro-info', function () {
23
return false;
142
});
143
144
145
+
146
+ jQuery(document).on('click', '#b2s-user-network-settings-allow-shortcode', function () {
147
+ jQuery('.b2s-settings-user-success').hide();
148
+ jQuery('.b2s-settings-user-error').hide();
149
+ jQuery(".b2s-loading-area").show();
150
+ jQuery(".b2s-user-settings-area").hide();
151
+ jQuery('.b2s-server-connection-fail').hide();
152
+ jQuery.ajax({
153
+ url: ajaxurl,
154
+ type: "POST",
155
+ dataType: "json",
156
+ cache: false,
157
+ data: {
158
+ 'action': 'b2s_user_network_settings',
159
+ 'allow_shortcode': jQuery('#b2s-user-network-settings-allow-shortcode').val(),
160
+ },
161
+ error: function () {
162
+ jQuery('.b2s-server-connection-fail').show();
163
+ return false;
164
+ },
165
+ success: function (data) {
166
+ jQuery(".b2s-loading-area").hide();
167
+ jQuery(".b2s-user-settings-area").show();
168
+ if (data.result == true) {
169
+ jQuery('.b2s-settings-user-success').show();
170
+ jQuery('#b2s-user-network-settings-allow-shortcode').val(data.content);
171
+ if (jQuery("#b2s-user-network-settings-allow-shortcode").is(":checked")) {
172
+ jQuery('#b2s-user-network-settings-allow-shortcode').prop('checked', false);
173
+ } else {
174
+ jQuery('#b2s-user-network-settings-allow-shortcode').prop('checked', true);
175
+ }
176
+ } else {
177
+ jQuery('.b2s-settings-user-error').show();
178
+ }
179
+ }
180
+ });
181
+
182
+ return false;
183
+ });
184
+
185
+
186
jQuery(document).on('change', '.b2s-user-network-settings-post-format', function () {
187
jQuery('.b2s-settings-user-success').hide();
188
jQuery('.b2s-settings-user-error').hide();
assets/js/b2s/ship.js CHANGED
@@ -379,7 +379,7 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
379
autoclose: true
380
});
381
jQuery('.b2s-post-item-details-release-input-time').timepicker({
382
- minuteStep: 30,
383
appendWidgetTo: 'body',
384
showSeconds: false,
385
showMeridian: showMeridian,
@@ -454,7 +454,7 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
454
}
455
456
jQuery('.checkNetworkImage:checked').trigger('click');
457
-
458
initSceditor(data.networkAuthId);
459
}
460
}
@@ -571,6 +571,13 @@ jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select'
571
});
572
573
574
jQuery(document).on('click', '.b2s-re-share-btn', function () {
575
jQuery(".b2s-settings-user-sched-time-area").show();
576
jQuery('#b2s-sidebar-wrapper').show();
@@ -585,6 +592,7 @@ jQuery(document).on('click', '.b2s-re-share-btn', function () {
585
jQuery('.b2s-footer-menu').show();
586
window.scrollTo(0, 0);
587
jQuery('.b2s-reporting-btn-area').hide();
588
return false;
589
});
590
@@ -804,6 +812,9 @@ jQuery("#b2sNetworkSent").validate({
804
if (checkNetworkSelected() == false) {
805
return false;
806
}
807
808
var userDate = new Date();
809
jQuery("#user_timezone").val((userDate.getTimezoneOffset() / 60) * -1);
@@ -996,7 +1007,7 @@ function init(firstrun) {
996
autoclose: true
997
});
998
jQuery('.b2s-post-item-details-release-input-time').timepicker({
999
- minuteStep: 30,
1000
appendWidgetTo: 'body',
1001
showSeconds: false,
1002
showMeridian: showMeridian,
@@ -1171,6 +1182,20 @@ function checkNetworkSelected() {
1171
}
1172
}
1173
1174
function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
1175
var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
1176
jQuery('.b2s-post-item-details-releas-area-details-row' + selectorInput).hide();
@@ -1252,7 +1277,7 @@ function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
1252
}
1253
1254
jQuery('.b2s-post-item-details-release-input-time').timepicker({
1255
- minuteStep: 30,
1256
appendWidgetTo: 'body',
1257
showSeconds: false,
1258
showMeridian: showMeridian,
379
autoclose: true
380
});
381
jQuery('.b2s-post-item-details-release-input-time').timepicker({
382
+ minuteStep: 15,
383
appendWidgetTo: 'body',
384
showSeconds: false,
385
showMeridian: showMeridian,
454
}
455
456
jQuery('.checkNetworkImage:checked').trigger('click');
457
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
458
initSceditor(data.networkAuthId);
459
}
460
}
571
});
572
573
574
+ jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
575
+ jQuery('#b2sSchedPostInfoIgnore').val("1");
576
+ jQuery('.b2s-submit-btn').trigger("click");
577
+ return false;
578
+ });
579
+
580
+
581
jQuery(document).on('click', '.b2s-re-share-btn', function () {
582
jQuery(".b2s-settings-user-sched-time-area").show();
583
jQuery('#b2s-sidebar-wrapper').show();
592
jQuery('.b2s-footer-menu').show();
593
window.scrollTo(0, 0);
594
jQuery('.b2s-reporting-btn-area').hide();
595
+ jQuery('#b2sSchedPostInfoIgnore').val("0");
596
return false;
597
});
598
812
if (checkNetworkSelected() == false) {
813
return false;
814
}
815
+ if (checkPostSchedOnBlog() == false) {
816
+ return false;
817
+ }
818
819
var userDate = new Date();
820
jQuery("#user_timezone").val((userDate.getTimezoneOffset() / 60) * -1);
1007
autoclose: true
1008
});
1009
jQuery('.b2s-post-item-details-release-input-time').timepicker({
1010
+ minuteStep: 15,
1011
appendWidgetTo: 'body',
1012
showSeconds: false,
1013
showMeridian: showMeridian,
1182
}
1183
}
1184
1185
+ function checkPostSchedOnBlog() {
1186
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
1187
+ if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
1188
+ if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
1189
+ jQuery('#b2s-network-sched-post-info').modal("show");
1190
+ return false;
1191
+ }
1192
+ }
1193
+ }
1194
+ return true;
1195
+ }
1196
+
1197
+
1198
+
1199
function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
1200
var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
1201
jQuery('.b2s-post-item-details-releas-area-details-row' + selectorInput).hide();
1277
}
1278
1279
jQuery('.b2s-post-item-details-release-input-time').timepicker({
1280
+ minuteStep: 15,
1281
appendWidgetTo: 'body',
1282
showSeconds: false,
1283
showMeridian: showMeridian,
assets/js/b2s/wp/post-meta-box.js CHANGED
@@ -52,7 +52,7 @@ jQuery(window).on("load", function () {
52
setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
53
}
54
jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
55
- jQuery('#b2s-post-meta-box-sched-date-picker').b2sdatepicker({'autoClose': true, 'toggleSelected': false, 'minutesStep': 30, 'minDate': today, 'startDate': today, 'todayButton': today});
56
jQuery('#b2s-post-meta-box-profil-dropdown [value="' + jQuery('#b2s-user-last-selected-profile-id').val() + '"]').prop('selected', true).trigger('change');
57
58
jQuery("#b2s-user-timezone").val((today.getTimezoneOffset() / 60) * -1);
@@ -108,7 +108,7 @@ jQuery(document).on('click', '#b2s-post-meta-box-time-dropdown-publish', functio
108
setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
109
}
110
jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
111
- jQuery('#b2s-post-meta-box-sched-date-picker').b2sdatepicker({'autoClose': true, 'toggleSelected': false, 'minutesStep': 30, 'minDate': today, 'startDate': today, 'todayButton': today});
112
jQuery('#b2s-post-meta-box-profil-dropdown [value="' + jQuery('#b2s-user-last-selected-profile-id').val() + '"]').prop('selected', true).trigger('change');
113
114
jQuery("#b2s-user-timezone").val((today.getTimezoneOffset() / 60) * -1);
@@ -128,8 +128,10 @@ jQuery(document).on('click', '#b2s-post-meta-box-time-dropdown-publish', functio
128
jQuery(document).on('change', '.b2s-post-meta-box-sched-select', function () {
129
if (jQuery(this).val() == '1') {
130
jQuery('.b2s-post-meta-box-sched-once').show();
131
} else {
132
jQuery('.b2s-post-meta-box-sched-once').hide();
133
}
134
});
135
52
setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
53
}
54
jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
55
+ jQuery('#b2s-post-meta-box-sched-date-picker').b2sdatepicker({'autoClose': true, 'toggleSelected': false, 'minutesStep': 15, 'minDate': today, 'startDate': today, 'todayButton': today});
56
jQuery('#b2s-post-meta-box-profil-dropdown [value="' + jQuery('#b2s-user-last-selected-profile-id').val() + '"]').prop('selected', true).trigger('change');
57
58
jQuery("#b2s-user-timezone").val((today.getTimezoneOffset() / 60) * -1);
108
setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
109
}
110
jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
111
+ jQuery('#b2s-post-meta-box-sched-date-picker').b2sdatepicker({'autoClose': true, 'toggleSelected': false, 'minutesStep': 15, 'minDate': today, 'startDate': today, 'todayButton': today});
112
jQuery('#b2s-post-meta-box-profil-dropdown [value="' + jQuery('#b2s-user-last-selected-profile-id').val() + '"]').prop('selected', true).trigger('change');
113
114
jQuery("#b2s-user-timezone").val((today.getTimezoneOffset() / 60) * -1);
128
jQuery(document).on('change', '.b2s-post-meta-box-sched-select', function () {
129
if (jQuery(this).val() == '1') {
130
jQuery('.b2s-post-meta-box-sched-once').show();
131
+ jQuery('#b2s-post-meta-box-info-share-now').hide();
132
} else {
133
jQuery('.b2s-post-meta-box-sched-once').hide();
134
+ jQuery('#b2s-post-meta-box-info-share-now').show();
135
}
136
});
137
includes/Ajax/Get.php CHANGED
@@ -189,7 +189,8 @@ class Ajax_Get {
189
if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['defaultUrl']) && $_POST['defaultUrl'] == $_POST['url']) {
190
$postData = get_post($_POST['postId']);
191
if ($postData->post_status != 'publish') {
192
- $metaInfo = array('title' => B2S_Util::getExcerpt($postData->post_title, 50) . ' - ' . get_option('blogname'), 'description' => B2S_Util::getExcerpt(B2S_Util::prepareContent($postData->post_content, false), 150));
193
} else {
194
$metaInfo = B2S_Util::getMetaTags((int) $_POST['postId'], strip_tags($_POST['url']), (int) $_POST['networkId']);
195
}
189
if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['defaultUrl']) && $_POST['defaultUrl'] == $_POST['url']) {
190
$postData = get_post($_POST['postId']);
191
if ($postData->post_status != 'publish') {
192
+ $postUrl = (get_permalink($postData->ID) !== false ? get_permalink($postData->ID) : $postData->guid);
193
+ $metaInfo = array('title' => B2S_Util::getExcerpt(B2S_Util::remove4byte($postData->post_title), 50) . ' - ' . get_option('blogname'), 'description' => B2S_Util::getExcerpt(B2S_Util::prepareContent($postData->ID,$postData->post_content,$postUrl, false,false), 150));
194
} else {
195
$metaInfo = B2S_Util::getMetaTags((int) $_POST['postId'], strip_tags($_POST['url']), (int) $_POST['networkId']);
196
}
includes/Ajax/Post.php CHANGED
@@ -185,7 +185,7 @@ class Ajax_Post {
185
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
186
'saveSetting' => isset($data['saveSchedSetting']) ? true : false
187
);
188
-
189
$schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData);
190
$content = array_merge($content, $schedResult);
191
}
@@ -234,6 +234,17 @@ class Ajax_Post {
234
wp_die();
235
}
236
}
237
echo json_encode(array('result' => false));
238
wp_die();
239
}
185
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
186
'saveSetting' => isset($data['saveSchedSetting']) ? true : false
187
);
188
+
189
$schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData);
190
$content = array_merge($content, $schedResult);
191
}
234
wp_die();
235
}
236
}
237
+
238
+ if (isset($_POST['allow_shortcode'])) {
239
+ if ((int) $_POST['allow_shortcode'] == 1) {
240
+ delete_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID);
241
+ } else {
242
+ update_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID, 1);
243
+ }
244
+ echo json_encode(array('result' => true, 'content' => (((int) $_POST['allow_shortcode'] == 1) ? 0 : 1)));
245
+ wp_die();
246
+ }
247
+
248
echo json_encode(array('result' => false));
249
wp_die();
250
}
includes/AutoShare.php CHANGED
@@ -4,26 +4,29 @@ class B2S_AutoShare {
4
5
private $title;
6
private $contentHtml;
7
private $content;
8
private $url;
9
private $imageUrl;
10
private $keywords;
11
private $blogPostData = array();
12
private $myTimeSettings = array();
13
private $current_user_date;
14
private $setPreFillText;
15
16
- function __construct($blogPostData = array(), $current_user_date = '0000-00-00 00:00:00', $myTimeSettings = false, $title = '', $content = '', $url = '', $imageUrl = '', $keywords = '') {
17
$this->blogPostData = $blogPostData;
18
$this->current_user_date = $current_user_date;
19
$this->myTimeSettings = $myTimeSettings;
20
- $this->title = $title;
21
- $this->content = B2S_Util::prepareContent($content, false);
22
- $this->contentHtml = B2S_Util::prepareContent($content, '<p><h1><h2><br><i><b><a><img>');
23
$this->url = $url;
24
$this->imageUrl = $imageUrl;
25
$this->keywords = $keywords;
26
- $this->setPreFillText = array(0 => array(1 => 239, 2 => 116, 3 => 239, 6 => 300, 8 => 239, 10 => 442, 12 => 240, 9 => 200), 1 => array(1 => 239, 3 => 239, 8 => 1200, 10 => 442), 2 => array(8 => 239, 10 => 442));
27
}
28
29
public function prepareShareData($networkAuthId = 0, $networkId = 0, $networkType = 0) {
@@ -89,7 +92,7 @@ class B2S_AutoShare {
89
$postData['content'] = $this->contentHtml;
90
}
91
92
- if ($networkId == 13) {
93
$postData['content'] = strip_tags($this->title);
94
}
95
return $postData;
@@ -153,10 +156,10 @@ class B2S_AutoShare {
153
$wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($shareData), 'image_url' => (isset($shareData['image_url']) ? $shareData['image_url'] : '')), array('%s', '%s'));
154
$schedDetailsId = $wpdb->insert_id;
155
$wpdb->insert('b2s_posts', array(
156
- 'post_id' => $this->blogPostData['post_id'],
157
'blog_user_id' => $this->blogPostData['blog_user_id'],
158
'user_timezone' => $this->blogPostData['user_timezone'],
159
- 'publish_date' => "0000-00-00 00:00:00",
160
'sched_details_id' => $schedDetailsId,
161
'sched_type' => $sched_type,
162
'sched_date' => $sched_date,
4
5
private $title;
6
private $contentHtml;
7
+ private $postId;
8
private $content;
9
private $url;
10
private $imageUrl;
11
private $keywords;
12
private $blogPostData = array();
13
private $myTimeSettings = array();
14
+ private $allowNoEmoji = array();
15
private $current_user_date;
16
private $setPreFillText;
17
18
+ function __construct($postId = 0, $blogPostData = array(), $current_user_date = '0000-00-00 00:00:00', $myTimeSettings = false, $title = '', $content = '', $url = '', $imageUrl = '', $keywords = '') {
19
+ $this->postId = $postId;
20
$this->blogPostData = $blogPostData;
21
$this->current_user_date = $current_user_date;
22
$this->myTimeSettings = $myTimeSettings;
23
+ $this->title = B2S_Util::remove4byte($title); //Remove Emoji by Schedule
24
+ $this->content = B2S_Util::prepareContent($postId, $content, $url, false, false); //Remove Emoji by Schedule
25
+ $this->contentHtml = B2S_Util::prepareContent($postId, $content, $url, '<p><h1><h2><br><i><b><a><img>', false); //Remove Emoji by Schedule
26
$this->url = $url;
27
$this->imageUrl = $imageUrl;
28
$this->keywords = $keywords;
29
+ $this->setPreFillText = array(0 => array(1 => 239, 2 => 116, 3 => 239, 6 => 300, 8 => 239, 10 => 442, 12 => 240, 9 => 200), 1 => array(1 => 239, 3 => 239, 8 => 1200, 10 => 442), 2 => array(1 => 239, 8 => 239, 10 => 442));
30
}
31
32
public function prepareShareData($networkAuthId = 0, $networkId = 0, $networkType = 0) {
92
$postData['content'] = $this->contentHtml;
93
}
94
95
+ if ($networkId == 13 || $networkId == 15) {
96
$postData['content'] = strip_tags($this->title);
97
}
98
return $postData;
156
$wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($shareData), 'image_url' => (isset($shareData['image_url']) ? $shareData['image_url'] : '')), array('%s', '%s'));
157
$schedDetailsId = $wpdb->insert_id;
158
$wpdb->insert('b2s_posts', array(
159
+ 'post_id' => $this->postId,
160
'blog_user_id' => $this->blogPostData['blog_user_id'],
161
'user_timezone' => $this->blogPostData['user_timezone'],
162
+ 'publish_date' => (($sched_type == 3) ? $sched_date : "0000-00-00 00:00:00"),
163
'sched_details_id' => $schedDetailsId,
164
'sched_type' => $sched_type,
165
'sched_date' => $sched_date,
includes/B2S/Api/Post.php CHANGED
@@ -19,6 +19,7 @@ class B2S_Api_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
$result = curl_exec($ch);
23
return $result;
24
}
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
}
includes/B2S/Heartbeat.php CHANGED
@@ -79,8 +79,8 @@ class B2S_Heartbeat {
79
$networkTypeData = array('profil' => 0, 'page' => 1, 'group' => 2);
80
global $wpdb;
81
$sql = "SELECT posts.id, posts.user_timezone, posts.sched_date, posts.sched_date_utc, posts.v2_id, user.token FROM b2s_posts as posts "
82
- . "LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE posts.sched_date_utc != %s AND posts.sched_date_utc <= %s AND posts.publish_date = %s AND posts.hide=%d";
83
- $select = $wpdb->prepare($sql, '0000-00-00 00:00:00', gmdate('Y-m-d H:i:s'), '0000-00-00 00:00:00', 0);
84
85
$sendData = $wpdb->get_results($select, ARRAY_A);
86
if (isset($sendData[0])) {
79
$networkTypeData = array('profil' => 0, 'page' => 1, 'group' => 2);
80
global $wpdb;
81
$sql = "SELECT posts.id, posts.user_timezone, posts.sched_date, posts.sched_date_utc, posts.v2_id, user.token FROM b2s_posts as posts "
82
+ . "LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE posts.sched_date_utc != %s AND posts.sched_date_utc <= %s AND posts.hide=%d"; //AND posts.publish_date = %s
83
+ $select = $wpdb->prepare($sql, '0000-00-00 00:00:00', gmdate('Y-m-d H:i:s'), 0); //,'0000-00-00 00:00:00'
84
85
$sendData = $wpdb->get_results($select, ARRAY_A);
86
if (isset($sendData[0])) {
includes/B2S/Network/Item.php CHANGED
@@ -17,7 +17,7 @@ class B2S_Network_Item {
17
}
18
19
public function getData() {
20
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getUserAuth', 'auth_count' => true, 'token' => B2S_PLUGIN_TOKEN)));
21
return array('mandanten' => isset($result->mandanten) ? $result->mandanten : '',
22
'auth' => isset($result->auth) ? $result->auth : '',
23
'auth_count' => isset($result->auth_count) ? $result->auth_count : false,
@@ -38,9 +38,9 @@ class B2S_Network_Item {
38
39
public function getPortale($mandanten, $auth, $portale, $auth_count) {
40
$mandantenId = array(0);
41
- foreach ($mandanten as $k => $v) {
42
- $mandantenId[] = $k;
43
- }
44
45
$html = '<div class="col-md-12 b2s-network-details-container">';
46
17
}
18
19
public function getData() {
20
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getUserAuth', 'auth_count' => true, 'token' => B2S_PLUGIN_TOKEN, 'version' => B2S_PLUGIN_VERSION)));
21
return array('mandanten' => isset($result->mandanten) ? $result->mandanten : '',
22
'auth' => isset($result->auth) ? $result->auth : '',
23
'auth_count' => isset($result->auth_count) ? $result->auth_count : false,
38
39
public function getPortale($mandanten, $auth, $portale, $auth_count) {
40
$mandantenId = array(0);
41
+ foreach ($mandanten as $k => $v) {
42
+ $mandantenId[] = $k;
43
+ }
44
45
$html = '<div class="col-md-12 b2s-network-details-container">';
46
includes/B2S/Post/Filter.php CHANGED
@@ -85,7 +85,7 @@ class B2S_Post_Filter {
85
$taxonomies = get_taxonomies(array('public' => true), "object", "and");
86
$type = '<div class="form-group"><select id="b2sSortPostCat" name="b2sSortPostCat" class="form-control b2s-select"><option value="">' . __('all categories & tags', 'blog2social') . '</option>';
87
foreach ($taxonomies as $tax => $taxValue) {
88
- $cat = get_categories(array('taxonomy' => $taxValue->name));
89
if (!empty($cat)) {
90
$type.='<optgroup label="' . $taxValue->labels->name . '">';
91
foreach ($cat as $key => $categorie) {
85
$taxonomies = get_taxonomies(array('public' => true), "object", "and");
86
$type = '<div class="form-group"><select id="b2sSortPostCat" name="b2sSortPostCat" class="form-control b2s-select"><option value="">' . __('all categories & tags', 'blog2social') . '</option>';
87
foreach ($taxonomies as $tax => $taxValue) {
88
+ $cat = get_categories(array('taxonomy' => $taxValue->name,'number' =>100)); //since 3.7.0 => all too much load
89
if (!empty($cat)) {
90
$type.='<optgroup label="' . $taxValue->labels->name . '">';
91
foreach ($cat as $key => $categorie) {
includes/B2S/Post/Item.php CHANGED
@@ -110,7 +110,7 @@ class B2S_Post_Item {
110
if ($this->type == 'publish' || $this->type == 'sched') {
111
//ExistsTable
112
if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts'") == 'b2s_posts') {
113
- $where = ($this->type == 'publish') ? " `hide` = 0 AND `sched_date`= '0000-00-00 00:00:00' $addNotAdminPosts GROUP BY `post_id` ORDER BY `publish_date` " . $sortType : " `hide` = 0 AND `publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts GROUP BY `post_id` ORDER BY `sched_date` " . $sortType;
114
$orderBy = ($this->type == 'publish') ? " ORDER BY `publish_date` " . $sortType : " ORDER BY `sched_date` " . $sortType;
115
$addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish') ? " DATE_FORMAT(publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND " : " DATE_FORMAT(sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND ") : '';
116
$select = ($this->type == 'publish') ? 'filter.`blog_user_id`, filter.`publish_date`' : 'filter.`blog_user_id`, filter.`sched_date`';
@@ -142,7 +142,7 @@ class B2S_Post_Item {
142
143
//for Calender (mark Event)
144
} else {
145
- $where = ($this->type == 'publish') ? " `hide` = 0 AND `sched_date`= '0000-00-00 00:00:00' $addNotAdminPosts ORDER BY `publish_date` " . $sortType : " `hide` = 0 AND `publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts ORDER BY `sched_date` " . $sortType;
146
$sqlPostsTotal = "SELECT posts.`ID`, DATE_FORMAT(filter.`sched_date`,'%Y-%m-%d') AS sched
147
FROM `$wpdb->posts` posts $leftJoin
148
INNER JOIN(
@@ -189,24 +189,24 @@ class B2S_Post_Item {
189
if (strpos(strtolower($var->post_type), 'job') !== false) {
190
$postType = 'job';
191
}
192
-
193
//PostTitle - Bug: Converting json + PHP Extension
194
$postTitle = $var->post_title;
195
- if(function_exists('mb_strlen') && function_exists('mb_substr')) {
196
- $postTitle = (mb_strlen(trim($var->post_title),'UTF-8') > 80 ? mb_substr($var->post_title, 0, 77,'UTF-8') . '...' : $var->post_title);
197
}
198
-
199
200
if ($this->type == 'all') {
201
$userInfo = get_user_meta($var->post_author);
202
$lastPublish = $this->getLastPublish($var->ID);
203
$lastPublish = ($lastPublish != false) ? ' | ' . __('last shared on social media', 'blog2social') . ' ' . B2S_Util::getCustomDateFormat($lastPublish, substr(B2S_LANGUAGE, 0, 2)) : '';
204
-
205
$this->postItem .= '<li class="list-group-item">
206
<div class="media">
207
<img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
208
<div class="media-body">
209
- <strong><a target="_blank" href="' . get_permalink($var->ID) . '">' .$postTitle. '</a></strong>
210
<span class="pull-right b2s-publish-btn">
211
<a class="btn btn-success btn-sm publishPostBtn" href="admin.php?page=blog2social-ship&postId=' . $var->ID . '">' . __('Share on Social Media', 'blog2social') . '</a>
212
</span>
@@ -249,7 +249,7 @@ class B2S_Post_Item {
249
<img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
250
<div class="media-body">
251
<div class="pull-left media-head">
252
- <strong><a target="_blank" href="' . get_permalink($var->ID) . '">' .$postTitle . '</a></strong>
253
<span class="pull-right">
254
<button type="button" class="btn btn-primary btn-sm b2sDetailsSchedPostBtn" data-search-date="' . $this->searchShowByDate . '" data-post-id="' . $var->ID . '"><i class="glyphicon glyphicon-chevron-down"></i> ' . __('Details', 'blog2social') . '</button>
255
</span>
@@ -272,7 +272,7 @@ class B2S_Post_Item {
272
global $wpdb;
273
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
274
$addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish') ? " AND DATE_FORMAT(publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' " : " AND DATE_FORMAT(sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' ") : '';
275
- $where = ($this->type == 'publish') ? " `sched_date` = '0000-00-00 00:00:00' " : " `publish_date` = '0000-00-00 00:00:00'";
276
$sqlPostsTotal = "SELECT COUNT(`post_id`) FROM `b2s_posts` WHERE $where $addNotAdmin $addSearchShowByDate AND `hide` = 0 AND `post_id` = " . $post_id;
277
return $wpdb->get_var($sqlPostsTotal);
278
}
@@ -284,7 +284,7 @@ class B2S_Post_Item {
284
global $wpdb;
285
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
286
$order = ($this->type == 'publish') ? " `publish_date` DESC" : " `sched_date` ASC ";
287
- $where = ($this->type == 'publish') ? " `sched_date` = '0000-00-00 00:00:00' " : " `publish_date` = '0000-00-00 00:00:00'";
288
$fields = $this->type == 'publish' ? "publish_date" : "sched_date";
289
$sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
290
return $wpdb->get_var($sqlLast);
@@ -297,7 +297,7 @@ class B2S_Post_Item {
297
global $wpdb;
298
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
299
$order = "`publish_date` DESC";
300
- $where = "`sched_date` = '0000-00-00 00:00:00' ";
301
$fields = "publish_date";
302
$sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
303
$result = $wpdb->get_results($sqlLast);
@@ -351,7 +351,7 @@ class B2S_Post_Item {
351
global $wpdb;
352
$addNotAdminPosts = (!B2S_PLUGIN_ADMIN) ? (' AND blog_user_id =' . B2S_PLUGIN_BLOG_USER_ID) : '';
353
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`publish_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
354
- $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`,`blog_user_id`,`publish_date`,`publish_link`,`sched_type`,`publish_error_code`,`b2s_posts_network_details`.`network_id`,`b2s_posts_network_details`.`network_type`, `b2s_posts_network_details`.`network_auth_id`, `b2s_posts_network_details`.`network_display_name` FROM `b2s_posts` LEFT JOIN `b2s_posts_network_details` ON `b2s_posts`.`network_details_id` = `b2s_posts_network_details`.`id` WHERE `b2s_posts`.`hide` = 0 AND `b2s_posts`.`sched_date` = '0000-00-00 00:00:00' $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`publish_date` DESC", $post_id);
355
$result = $wpdb->get_results($sqlData);
356
if (!empty($result) && is_array($result)) {
357
$networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
@@ -363,11 +363,17 @@ class B2S_Post_Item {
363
$autoPosting = (isset($var->sched_type) && (int) $var->sched_type == 3) ? ' - <strong>' . __('Auto-Posting', 'blog2social') . '</strong>' : '';
364
$publishLink = (!empty($var->publish_link)) ? '<a target="_blank" href="' . $var->publish_link . '">' . __('show', 'blog2social') . '</a> | ' : '';
365
$error = (!empty($var->publish_error_code)) ? '<span class="network-text-info text-danger hidden-xs"> <i class="glyphicon glyphicon-remove-circle glyphicon-danger"></i> ' . $networkErrorCode[trim($var->publish_error_code)] . '</span>' : '';
366
$userInfo = get_user_meta($var->blog_user_id);
367
$content .= ' <li class="list-group-item b2s-post-publish-area-li" data-post-id="' . $var->id . '">
368
<div class="media">';
369
370
- $content .='<input class="checkboxes pull-left checkbox-item" data-blog-post-id="' . $post_id . '" name="selected-checkbox-item" value="' . $var->id . '" type="checkbox">';
371
372
if (!empty($var->publish_link)) {
373
$content .= '<a class="pull-left" target="_blank" href="' . $var->publish_link . '"><img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype"></a>';
@@ -376,11 +382,14 @@ class B2S_Post_Item {
376
}
377
$content .= '<div class="media-body">
378
<strong>' . $networkName[$var->network_id] . '</strong> ' . $error . '
379
- <p class="info">' . $networkType[$var->network_type] . (!empty($var->network_display_name) ? (': ' . $var->network_display_name) : '' ) . ' | ' . __('shared by', 'blog2social') . ' <a href="' . get_author_posts_url($var->blog_user_id) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> ' . B2S_Util::getCustomDateFormat($var->publish_date, substr(B2S_LANGUAGE, 0, 2)) . $autoPosting . '</p>
380
<p class="info">' . $publishLink;
381
382
- $content .= B2S_PLUGIN_USER_VERSION > 0 ? '<a href="#" class="b2s-post-publish-area-drop-btn" data-post-id="' . $var->id . '">' : '<a href="#" data-toggle="modal" data-title="' . __('You want to delete a publish post entry?', 'blog2social') . '" data-target="#b2sProFeatureModal" >';
383
- $content .= __('delete from reporting', 'blog2social') . '</a> ';
384
if (!empty($error)) {
385
$content .= '| <a href="admin.php?page=blog2social-ship&postId=' . $post_id . '&network_auth_id=' . $var->network_auth_id . '">' . __('re-share', 'blog2social') . '</a>';
386
}
@@ -405,7 +414,7 @@ class B2S_Post_Item {
405
global $wpdb;
406
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `b2s_posts`.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
407
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`sched_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
408
- $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`,`blog_user_id`,`v2_id`, `sched_date`, `sched_type`,`b2s_posts_network_details`.`network_id`,`b2s_posts_network_details`.`network_type`,`b2s_posts_network_details`.`network_display_name` FROM `b2s_posts` LEFT JOIN `b2s_posts_network_details` ON `b2s_posts`.`network_details_id` = `b2s_posts_network_details`.`id` WHERE `b2s_posts`.`hide` = 0 AND `b2s_posts`.`publish_date` = '0000-00-00 00:00:00' $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`sched_date` ASC ", $post_id);
409
$result = $wpdb->get_results($sqlData);
410
if (!empty($result) && is_array($result)) {
411
$networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
@@ -413,7 +422,6 @@ class B2S_Post_Item {
413
$content = '<div class="row"><div class="col-md-12"><ul class="list-group">';
414
$content .='<li class="list-group-item"><label class="checkbox-inline checkbox-all-label"><input class="checkbox-all" data-blog-post-id="' . $post_id . '" name="selected-checkbox-all" value="" type="checkbox"> ' . __('select all', 'blog2social') . '</label></li>';
415
foreach ($result as $var) {
416
- $autoPosting = (isset($var->sched_type) && (int) $var->sched_type == 3) ? ' - <strong>' . __('Auto-Posting', 'blog2social') . '</strong>' : '';
417
$userInfo = get_user_meta($var->blog_user_id);
418
$content .= '<li class="list-group-item b2s-post-sched-area-li" data-post-id="' . $var->id . '">
419
<div class="media">';
@@ -422,7 +430,7 @@ class B2S_Post_Item {
422
$content .='<img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype">
423
<div class="media-body">
424
<strong>' . $networkName[$var->network_id] . '</strong>
425
- <p class="info">' . $networkType[$var->network_type] . (!empty($var->network_display_name) ? (': ' . $var->network_display_name) : '' ) . ' | ' . __('scheduled by', 'blog2social') . ' <a href="' . get_author_posts_url($var->blog_user_id) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> <span class="b2s-post-sched-area-sched-time" data-post-id="' . $var->id . '">' . B2S_Util::getCustomDateFormat($var->sched_date, substr(B2S_LANGUAGE, 0, 2)) . $autoPosting . '</span></p>
426
<p class="info">';
427
428
$content .= (B2S_PLUGIN_USER_VERSION > 0) ? '<a href="#" class="b2s-post-sched-area-drop-btn" data-post-id="' . $var->id . '">' : '<a href="#" data-toggle="modal" data-title="' . __('You want to delete an scheduled post entry?', 'blog2social') . '" data-target="#b2sProFeatureModal" >';
110
if ($this->type == 'publish' || $this->type == 'sched') {
111
//ExistsTable
112
if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts'") == 'b2s_posts') {
113
+ $where = ($this->type == 'publish') ? " `hide` = 0 AND (`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) $addNotAdminPosts GROUP BY `post_id` ORDER BY `publish_date` " . $sortType : " `hide` = 0 AND `sched_type` != 3 AND `publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts GROUP BY `post_id` ORDER BY `sched_date` " . $sortType;
114
$orderBy = ($this->type == 'publish') ? " ORDER BY `publish_date` " . $sortType : " ORDER BY `sched_date` " . $sortType;
115
$addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish') ? " DATE_FORMAT(publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND " : " DATE_FORMAT(sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND ") : '';
116
$select = ($this->type == 'publish') ? 'filter.`blog_user_id`, filter.`publish_date`' : 'filter.`blog_user_id`, filter.`sched_date`';
142
143
//for Calender (mark Event)
144
} else {
145
+ $where = ($this->type == 'publish') ? " `hide` = 0 AND (`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) $addNotAdminPosts ORDER BY `publish_date` " . $sortType : " `hide` = 0 AND `sched_type` != 3 AND `publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts ORDER BY `sched_date` " . $sortType;
146
$sqlPostsTotal = "SELECT posts.`ID`, DATE_FORMAT(filter.`sched_date`,'%Y-%m-%d') AS sched
147
FROM `$wpdb->posts` posts $leftJoin
148
INNER JOIN(
189
if (strpos(strtolower($var->post_type), 'job') !== false) {
190
$postType = 'job';
191
}
192
+
193
//PostTitle - Bug: Converting json + PHP Extension
194
$postTitle = $var->post_title;
195
+ if (function_exists('mb_strlen') && function_exists('mb_substr')) {
196
+ $postTitle = (mb_strlen(trim($var->post_title), 'UTF-8') > 80 ? mb_substr($var->post_title, 0, 77, 'UTF-8') . '...' : $var->post_title);
197
}
198
+
199
200
if ($this->type == 'all') {
201
$userInfo = get_user_meta($var->post_author);
202
$lastPublish = $this->getLastPublish($var->ID);
203
$lastPublish = ($lastPublish != false) ? ' | ' . __('last shared on social media', 'blog2social') . ' ' . B2S_Util::getCustomDateFormat($lastPublish, substr(B2S_LANGUAGE, 0, 2)) : '';
204
+
205
$this->postItem .= '<li class="list-group-item">
206
<div class="media">
207
<img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
208
<div class="media-body">
209
+ <strong><a target="_blank" href="' . get_permalink($var->ID) . '">' . $postTitle . '</a></strong>
210
<span class="pull-right b2s-publish-btn">
211
<a class="btn btn-success btn-sm publishPostBtn" href="admin.php?page=blog2social-ship&postId=' . $var->ID . '">' . __('Share on Social Media', 'blog2social') . '</a>
212
</span>
249
<img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
250
<div class="media-body">
251
<div class="pull-left media-head">
252
+ <strong><a target="_blank" href="' . get_permalink($var->ID) . '">' . $postTitle . '</a></strong>
253
<span class="pull-right">
254
<button type="button" class="btn btn-primary btn-sm b2sDetailsSchedPostBtn" data-search-date="' . $this->searchShowByDate . '" data-post-id="' . $var->ID . '"><i class="glyphicon glyphicon-chevron-down"></i> ' . __('Details', 'blog2social') . '</button>
255
</span>
272
global $wpdb;
273
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
274
$addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish') ? " AND DATE_FORMAT(publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' " : " AND DATE_FORMAT(sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' ") : '';
275
+ $where = ($this->type == 'publish') ? " (`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) " : " `sched_type` != 3 AND `publish_date` = '0000-00-00 00:00:00'";
276
$sqlPostsTotal = "SELECT COUNT(`post_id`) FROM `b2s_posts` WHERE $where $addNotAdmin $addSearchShowByDate AND `hide` = 0 AND `post_id` = " . $post_id;
277
return $wpdb->get_var($sqlPostsTotal);
278
}
284
global $wpdb;
285
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
286
$order = ($this->type == 'publish') ? " `publish_date` DESC" : " `sched_date` ASC ";
287
+ $where = ($this->type == 'publish') ? " (`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) " : " `sched_type` != 3 AND `publish_date` = '0000-00-00 00:00:00'";
288
$fields = $this->type == 'publish' ? "publish_date" : "sched_date";
289
$sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
290
return $wpdb->get_var($sqlLast);
297
global $wpdb;
298
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
299
$order = "`publish_date` DESC";
300
+ $where = "(`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) ";
301
$fields = "publish_date";
302
$sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
303
$result = $wpdb->get_results($sqlLast);
351
global $wpdb;
352
$addNotAdminPosts = (!B2S_PLUGIN_ADMIN) ? (' AND blog_user_id =' . B2S_PLUGIN_BLOG_USER_ID) : '';
353
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`publish_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
354
+ $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`,`blog_user_id`, `sched_date`,`publish_date`,`publish_link`,`sched_type`,`publish_error_code`,`b2s_posts_network_details`.`network_id`,`b2s_posts_network_details`.`network_type`, `b2s_posts_network_details`.`network_auth_id`, `b2s_posts_network_details`.`network_display_name` FROM `b2s_posts` LEFT JOIN `b2s_posts_network_details` ON `b2s_posts`.`network_details_id` = `b2s_posts_network_details`.`id` WHERE `b2s_posts`.`hide` = 0 AND (`b2s_posts`.`sched_date` = '0000-00-00 00:00:00' OR `b2s_posts`.`sched_type` = 3) $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`publish_date` DESC", $post_id);
355
$result = $wpdb->get_results($sqlData);
356
if (!empty($result) && is_array($result)) {
357
$networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
363
$autoPosting = (isset($var->sched_type) && (int) $var->sched_type == 3) ? ' - <strong>' . __('Auto-Posting', 'blog2social') . '</strong>' : '';
364
$publishLink = (!empty($var->publish_link)) ? '<a target="_blank" href="' . $var->publish_link . '">' . __('show', 'blog2social') . '</a> | ' : '';
365
$error = (!empty($var->publish_error_code)) ? '<span class="network-text-info text-danger hidden-xs"> <i class="glyphicon glyphicon-remove-circle glyphicon-danger"></i> ' . $networkErrorCode[trim($var->publish_error_code)] . '</span>' : '';
366
+ $publishDate = ($var->sched_date == "0000-00-00 00:00:00") ? B2S_Util::getCustomDateFormat($var->publish_date, substr(B2S_LANGUAGE, 0, 2)) : '';
367
+ $publishText = (empty($publishDate)) ? __('sharing in progress by', 'blog2social') : __('shared by', 'blog2social');
368
$userInfo = get_user_meta($var->blog_user_id);
369
$content .= ' <li class="list-group-item b2s-post-publish-area-li" data-post-id="' . $var->id . '">
370
<div class="media">';
371
372
+ if (!empty($publishDate)) {
373
+ $content .='<input class="checkboxes pull-left checkbox-item" data-blog-post-id="' . $post_id . '" name="selected-checkbox-item" value="' . $var->id . '" type="checkbox">';
374
+ }else{
375
+ $content .='<div class="checbox-item-empty"></div>';
376
+ }
377
378
if (!empty($var->publish_link)) {
379
$content .= '<a class="pull-left" target="_blank" href="' . $var->publish_link . '"><img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype"></a>';
382
}
383
$content .= '<div class="media-body">
384
<strong>' . $networkName[$var->network_id] . '</strong> ' . $error . '
385
+ <p class="info">' . $networkType[$var->network_type] . (!empty($var->network_display_name) ? (': ' . $var->network_display_name) : '' ) . ' | ' . $publishText . ' <a href="' . get_author_posts_url($var->blog_user_id) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> ' . $publishDate . $autoPosting . '</p>
386
<p class="info">' . $publishLink;
387
388
+ if (!empty($var->publish_link) || !empty($var->publish_error_code)) {
389
+ $content .= (B2S_PLUGIN_USER_VERSION > 0) ? '<a href="#" class="b2s-post-publish-area-drop-btn" data-post-id="' . $var->id . '">' : '<a href="#" data-toggle="modal" data-title="' . __('You want to delete a publish post entry?', 'blog2social') . '" data-target="#b2sProFeatureModal" >';
390
+ $content .= __('delete from reporting', 'blog2social') . '</a> ';
391
+ }
392
+
393
if (!empty($error)) {
394
$content .= '| <a href="admin.php?page=blog2social-ship&postId=' . $post_id . '&network_auth_id=' . $var->network_auth_id . '">' . __('re-share', 'blog2social') . '</a>';
395
}
414
global $wpdb;
415
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `b2s_posts`.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
416
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`sched_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
417
+ $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`,`blog_user_id`,`v2_id`, `sched_date`,`b2s_posts_network_details`.`network_id`,`b2s_posts_network_details`.`network_type`,`b2s_posts_network_details`.`network_display_name` FROM `b2s_posts` LEFT JOIN `b2s_posts_network_details` ON `b2s_posts`.`network_details_id` = `b2s_posts_network_details`.`id` WHERE `b2s_posts`.`hide` = 0 AND `b2s_posts`.`sched_type` != 3 AND `b2s_posts`.`publish_date` = '0000-00-00 00:00:00' $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`sched_date` ASC ", $post_id);
418
$result = $wpdb->get_results($sqlData);
419
if (!empty($result) && is_array($result)) {
420
$networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
422
$content = '<div class="row"><div class="col-md-12"><ul class="list-group">';
423
$content .='<li class="list-group-item"><label class="checkbox-inline checkbox-all-label"><input class="checkbox-all" data-blog-post-id="' . $post_id . '" name="selected-checkbox-all" value="" type="checkbox"> ' . __('select all', 'blog2social') . '</label></li>';
424
foreach ($result as $var) {
425
$userInfo = get_user_meta($var->blog_user_id);
426
$content .= '<li class="list-group-item b2s-post-sched-area-li" data-post-id="' . $var->id . '">
427
<div class="media">';
430
$content .='<img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype">
431
<div class="media-body">
432
<strong>' . $networkName[$var->network_id] . '</strong>
433
+ <p class="info">' . $networkType[$var->network_type] . (!empty($var->network_display_name) ? (': ' . $var->network_display_name) : '' ) . ' | ' . __('scheduled by', 'blog2social') . ' <a href="' . get_author_posts_url($var->blog_user_id) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> <span class="b2s-post-sched-area-sched-time" data-post-id="' . $var->id . '">' . B2S_Util::getCustomDateFormat($var->sched_date, substr(B2S_LANGUAGE, 0, 2)) . '</span></p>
434
<p class="info">';
435
436
$content .= (B2S_PLUGIN_USER_VERSION > 0) ? '<a href="#" class="b2s-post-sched-area-drop-btn" data-post-id="' . $var->id . '">' : '<a href="#" data-toggle="modal" data-title="' . __('You want to delete an scheduled post entry?', 'blog2social') . '" data-target="#b2sProFeatureModal" >';
includes/B2S/Settings/Item.php CHANGED
@@ -20,7 +20,7 @@ class B2S_Settings_Item {
20
}
21
22
private function getSettings() {
23
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getSettings', 'token' => B2S_PLUGIN_TOKEN)));
24
if (is_object($result) && isset($result->result) && (int) $result->result == 1 && isset($result->portale) && is_array($result->portale)) {
25
$this->networkData = $result->portale;
26
if (isset($result->settings) && is_object($result->settings)) {
@@ -51,25 +51,29 @@ class B2S_Settings_Item {
51
52
public function getGeneralSettingsHtml() {
53
$isChecked = (isset($this->settings->short_url) && (int) $this->settings->short_url == 0) ? 1 : 0;
54
- $content = '<input type="checkbox" value="' . $isChecked . '" id="b2s-user-network-settings-short-url" ' . (($isChecked == 0) ? 'checked="checked"' : '') . ' /><label for="b2s-user-network-settings-short-url">' . __('use b2s.pm Link Shortner', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoLinkModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></label>';
55
$content .= '<br>';
56
57
$isCheckedAutoShare = (get_option('B2S_PLUGIN_USER_AUTO_SHARE_' . B2S_PLUGIN_BLOG_USER_ID) !== false && B2S_PLUGIN_USER_VERSION > 0) ? 1 : 0;
58
- $content .= '<input type="checkbox" data-user-version="' . B2S_PLUGIN_USER_VERSION . '" value="' . $isCheckedAutoShare . '" id="b2s-user-network-settings-auto-share" ' . (($isCheckedAutoShare == 1) ? 'checked="checked"' : '') . ' /><label for="b2s-user-network-settings-auto-share">' . __('save as default Auto-Posting', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoAutoShareModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></label>';
59
return $content;
60
}
61
62
public function getNetworkSettingsHtml() {
63
64
- $content = '<h4>' . __('Facebook - Specify the publication format', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoFBFormatModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></h4>';
65
$content .='<div class="b2s-user-network-settings-post-format-area col-md-12">';
66
$content .='<div class="col-md-4 col-xs-12">';
67
- $content .= '<b>1) '.__('Share with a focus on the link','blog2social').'</b><br><br>';
68
$content .= '<label><input type="radio" ' . (((isset($this->settings->network_post_format_1) && (int) $this->settings->network_post_format_1 == 0) || !isset($this->settings->network_post_format_1)) ? 'checked' : '') . ' name="b2s-user-network-settings-post-format-1" class="b2s-user-network-settings-post-format" data-network-id="1" value="0"/><img class="img-responsive b2s-display-inline" src="' . plugins_url('/assets/images/settings/b2s-post-format-1-1-' . (($this->lang == 'de') ? $this->lang : 'en') . '.png', B2S_PLUGIN_FILE) . '">';
69
$content .='</label>';
70
$content .='</div>';
71
$content .='<div class="col-md-4 col-xs-12">';
72
- $content .= '<b>2) '.__('Share with a focus on the image','blog2social').'</b><br><br>';
73
$content .= '<label><input type="radio" ' . ((isset($this->settings->network_post_format_1) && (int) $this->settings->network_post_format_1 == 1) ? 'checked' : '') . ' name="b2s-user-network-settings-post-format-1" class="b2s-user-network-settings-post-format" data-network-id="1" value="1" /><img class="img-responsive b2s-display-inline" src="' . plugins_url('/assets/images/settings/b2s-post-format-1-2-' . (($this->lang == 'de') ? $this->lang : 'en') . '.png', B2S_PLUGIN_FILE) . '">';
74
$content .='</label>';
75
$content .='</div>';
@@ -77,7 +81,6 @@ class B2S_Settings_Item {
77
return $content;
78
}
79
80
- // $content .="<br>1)Share as Link";
81
82
public function getSchedSettingsHtml() {
83
if (!empty($this->networkData)) {
20
}
21
22
private function getSettings() {
23
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getSettings', 'token' => B2S_PLUGIN_TOKEN, 'version' => B2S_PLUGIN_VERSION)));
24
if (is_object($result) && isset($result->result) && (int) $result->result == 1 && isset($result->portale) && is_array($result->portale)) {
25
$this->networkData = $result->portale;
26
if (isset($result->settings) && is_object($result->settings)) {
51
52
public function getGeneralSettingsHtml() {
53
$isChecked = (isset($this->settings->short_url) && (int) $this->settings->short_url == 0) ? 1 : 0;
54
+ $content = '<input type="checkbox" value="' . $isChecked . '" id="b2s-user-network-settings-short-url" ' . (($isChecked == 0) ? 'checked="checked"' : '') . ' /><label for="b2s-user-network-settings-short-url"> ' . __('use b2s.pm Link Shortner', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoLinkModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></label>';
55
$content .= '<br>';
56
57
$isCheckedAutoShare = (get_option('B2S_PLUGIN_USER_AUTO_SHARE_' . B2S_PLUGIN_BLOG_USER_ID) !== false && B2S_PLUGIN_USER_VERSION > 0) ? 1 : 0;
58
+ $content .= '<input type="checkbox" data-user-version="' . B2S_PLUGIN_USER_VERSION . '" value="' . $isCheckedAutoShare . '" id="b2s-user-network-settings-auto-share" ' . (($isCheckedAutoShare == 1) ? 'checked="checked"' : '') . ' /><label for="b2s-user-network-settings-auto-share"> ' . __('activate Auto-Posting as default', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoAutoShareModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></label>';
59
+ $content .= '<br>';
60
+
61
+ $isCheckedAllowShortcode = (get_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID) !== false) ? 1 : 0;
62
+ $content .= '<input type="checkbox" value="' . $isCheckedAllowShortcode . '" id="b2s-user-network-settings-allow-shortcode" ' . (($isCheckedAllowShortcode == 1) ? 'checked="checked"' : '') . ' /><label for="b2s-user-network-settings-allow-shortcode"> ' . __('allow shortcodes in my post', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoAllowShortcodeModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></label>';
63
return $content;
64
}
65
66
public function getNetworkSettingsHtml() {
67
68
+ $content = '<h4>' . __('Select the appropriate post type for your Facebook posts', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoFBFormatModal" class="btn btn-link btn-lg del-padding-left"><span class="glyphicon glyphicon-info-sign glyphicon-success"></span></a></h4>';
69
$content .='<div class="b2s-user-network-settings-post-format-area col-md-12">';
70
$content .='<div class="col-md-4 col-xs-12">';
71
+ $content .= '<b>1) ' . __('Link Post', 'blog2social') . ' <span class="glyphicon glyphicon-link b2s-color-green"></span></b><br><br>';
72
$content .= '<label><input type="radio" ' . (((isset($this->settings->network_post_format_1) && (int) $this->settings->network_post_format_1 == 0) || !isset($this->settings->network_post_format_1)) ? 'checked' : '') . ' name="b2s-user-network-settings-post-format-1" class="b2s-user-network-settings-post-format" data-network-id="1" value="0"/><img class="img-responsive b2s-display-inline" src="' . plugins_url('/assets/images/settings/b2s-post-format-1-1-' . (($this->lang == 'de') ? $this->lang : 'en') . '.png', B2S_PLUGIN_FILE) . '">';
73
$content .='</label>';
74
$content .='</div>';
75
$content .='<div class="col-md-4 col-xs-12">';
76
+ $content .= '<b>2) ' . __('Photo Post', 'blog2social') . ' <span class="glyphicon glyphicon-picture b2s-color-green"></span></b><br><br>';
77
$content .= '<label><input type="radio" ' . ((isset($this->settings->network_post_format_1) && (int) $this->settings->network_post_format_1 == 1) ? 'checked' : '') . ' name="b2s-user-network-settings-post-format-1" class="b2s-user-network-settings-post-format" data-network-id="1" value="1" /><img class="img-responsive b2s-display-inline" src="' . plugins_url('/assets/images/settings/b2s-post-format-1-2-' . (($this->lang == 'de') ? $this->lang : 'en') . '.png', B2S_PLUGIN_FILE) . '">';
78
$content .='</label>';
79
$content .='</div>';
81
return $content;
82
}
83
84
85
public function getSchedSettingsHtml() {
86
if (!empty($this->networkData)) {
includes/B2S/Ship/Image.php CHANGED
@@ -8,12 +8,8 @@ class B2S_Ship_Image {
8
9
}
10
11
- private function getAllImageData($id) {
12
- return B2S_Util::getImagesByPostID($id, true);
13
- }
14
-
15
- public function getItemHtml($id) {
16
- $imageData = $this->getAllImageData($id);
17
$isImage = (is_array($imageData) && !empty($imageData)) ? true : false;
18
19
if ($isImage) {
@@ -38,8 +34,7 @@ class B2S_Ship_Image {
38
$tempCountImage++;
39
}
40
} else {
41
- $content = '<h4>' . __('Images not found', 'blog2social') . '</h4>';
42
- $content .= '<div class="b2s-image-warning-no-image alert alert-info">' . __('Pinterest, Flickr and Instagram can only be shared with a image included', 'blog2social') . '</div>';
43
}
44
$content .= "<input type='hidden' id='blog_image' name='blog_image' value='" . trim($isImage) . "'>";
45
8
9
}
10
11
+ public function getItemHtml($postId,$postContent,$postUrl) {
12
+ $imageData = B2S_Util::getImagesByPostID($postId,$postContent,$postUrl, true);
13
$isImage = (is_array($imageData) && !empty($imageData)) ? true : false;
14
15
if ($isImage) {
34
$tempCountImage++;
35
}
36
} else {
37
+ $content = '<div class="b2s-image-warning-no-image alert alert-info">' . __('For sharing your post to Pinterest, Flickr and Instagram, please include at least one image in your post.', 'blog2social') . '</div>';
38
}
39
$content .= "<input type='hidden' id='blog_image' name='blog_image' value='" . trim($isImage) . "'>";
40
includes/B2S/Ship/Item.php CHANGED
@@ -2,12 +2,12 @@
2
3
class B2S_Ship_Item {
4
5
- private $allowTitleProfile = array(7, 9, 13);
6
private $allowTitlePage = array();
7
private $allowTitleGroup = array();
8
private $isCommentProfile = array(1, 3, 8, 10);
9
private $isCommentPage = array();
10
- private $isCommentGroup = array(8);
11
private $allowTag = array(4, 9);
12
private $allowHtml = array(4, 11, 14);
13
private $showTitleProfile = array(4, 9, 11, 14);
@@ -15,25 +15,27 @@ class B2S_Ship_Item {
15
private $showTitleGroup = array(8);
16
private $onlyImage = array(6, 7, 12);
17
private $allowNoImageProfile = array(5, 9);
18
- private $allowNoCustomImageProfile = array(8);
19
private $allowNoImagePage = array(8);
20
- private $allowEditUrl = array(1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14);
21
private $showBoards = array(6);
22
- private $showGroups = array(8);
23
private $hideGroupName = array(8);
24
private $setShortTextProfile = array(1 => 239, 2 => 116, 3 => 239, 6 => 300, 8 => 239, 10 => 442, 12 => 240, 9 => 200);
25
private $setShortTextPage = array(1 => 239, 3 => 239, 8 => 1200, 10 => 442);
26
- private $setShortTextGroup = array(8 => 239, 10 => 442);
27
private $allowHashTags = array(6, 10, 12);
28
- private $limitCharacterProfile = array(2 => 140, 3 => 600, 6 => 500, 8 => 420, 9 => 250);
29
private $limitCharacterPage = array(3 => 600, 8 => 1200);
30
- private $requiredUrl = array(1, 3, 8, 9, 10);
31
private $getText = array(1, 7, 10, 12);
32
private $maxWeekTimeSelect = 52;
33
private $maxSchedCount = 3;
34
- private $noScheduleRegularly = array(4, 11, 14);
35
private $defaultImage;
36
- // private $allowPreview = array(1);
37
private $postData;
38
private $postUrl;
39
private $postStatus;
@@ -70,16 +72,17 @@ class B2S_Ship_Item {
70
$infoImage .= (in_array($data->networkId, $this->allowNoCustomImageProfile)) ? (!empty($infoImage) ? ' | ' : '') . __('Network defines image by link', 'blog2social') . '!' : '';
71
$htmlTags = highlight_string("<p><br><i><b><a><img>", true);
72
$infoImage .= (in_array($data->networkId, $this->allowHtml)) ? (!empty($infoImage) ? ' | ' : '') . __('Supported HTML tags', 'blog2social') . ': ' . $htmlTags : '';
73
74
$network_display_name = $data->network_display_name;
75
$isRequiredTextarea = (in_array($data->networkId, $this->isCommentProfile)) ? '' : 'required="required"';
76
77
//ShortText
78
if (isset($this->setShortTextProfile[$data->networkId]) && (int) $this->setShortTextProfile[$data->networkId] > 0) {
79
- $preContent = ($data->networkId == 2) ? $this->postData->post_title : B2S_Util::prepareContent($this->postData->post_content, false);
80
$message = B2S_Util::getExcerpt($preContent, (int) $this->setShortTextProfile[$data->networkId]);
81
} else {
82
- $message = (in_array($data->networkId, $this->allowTitleProfile) ? $this->postData->post_title : B2S_Util::prepareContent($this->postData->post_content, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false)));
83
}
84
85
//Hashtags
@@ -100,9 +103,10 @@ class B2S_Ship_Item {
100
} */
101
102
$infoCharacterCount = ($data->networkId != 2) ? ' (' . __('Text only', 'blog2social') . ')' : '';
103
- $excludedImageTransfer = ($data->networkId == 2) ? $this->excludedImageTransferHtml($data->networkId, $data->networkAuthId, $limitValue) : '';
104
-
105
- $textareaLimitInfo = $excludedImageTransfer . '<span class="b2s-post-item-countChar" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . $infoCharacterCount . '</span>';
106
$textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
107
} else {
108
//$countCharacter = in_array($data->networkId, $this->allowHtml) ? (int) mb_strlen(strip_tags($message), 'UTF-8') : (int) mb_strlen($message, 'UTF-8');
@@ -118,15 +122,16 @@ class B2S_Ship_Item {
118
$limit = true;
119
}
120
$infoImage = (in_array($data->networkId, $this->allowNoImagePage)) ? __('Network does not support image for pages', 'blog2social') . '!' : '';
121
122
//ShortText
123
if (isset($this->setShortTextPage[$data->networkId]) && (int) $this->setShortTextPage[$data->networkId] > 0) {
124
if ($data->networkId == 8) { //Xing -1 Leerzeichen
125
$this->setShortTextPage[$data->networkId] = (int) $this->setShortTextPage[$data->networkId] - mb_strlen($this->postUrl, 'UTF-8') - 1;
126
}
127
- $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postData->post_content, false), (int) $this->setShortTextPage[$data->networkId]);
128
} else {
129
- $message = (in_array($data->networkId, $this->allowTitlePage) ? $this->postData->post_title : B2S_Util::prepareContent($this->postData->post_content, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false)));
130
}
131
132
//Hashtags
@@ -139,15 +144,15 @@ class B2S_Ship_Item {
139
140
$countCharacter = 0;
141
if ($limit !== false) {
142
- /*$countValue = $limitValue;
143
- if ($data->networkId == 8) { //Xing -1 Leerzeichen
144
- $countValue = $limitValue - mb_strlen($this->postUrl, 'UTF-8') - 1;
145
- }
146
- $countCharacter = (int) $countValue - (in_array($data->networkId, $this->allowHtml) ? (int) mb_strlen(strip_tags($message), 'UTF-8') : (int) mb_strlen($message, 'UTF-8'));
147
- if ($countCharacter <= 0) {
148
- $message = mb_substr($message, 0, (int) $countValue);
149
- $countCharacter = 0;
150
- }*/
151
152
$textareaLimitInfo = '<span class="b2s-post-item-countChar" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . '</span>';
153
$textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
@@ -161,9 +166,9 @@ class B2S_Ship_Item {
161
//group
162
//ShortText
163
if (isset($this->setShortTextGroup[$data->networkId]) && (int) $this->setShortTextGroup[$data->networkId] > 0) {
164
- $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postData->post_content, false), (int) $this->setShortTextGroup[$data->networkId]);
165
} else {
166
- $message = (in_array($data->networkId, $this->allowTitleGroup) ? $this->postData->post_title : B2S_Util::prepareContent($this->postData->post_content, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false)));
167
}
168
//Hashtags
169
if (in_array($data->networkId, $this->allowHashTags)) {
@@ -174,12 +179,12 @@ class B2S_Ship_Item {
174
175
$countCharacter = 0;
176
if ($limit !== false) {
177
- /*$countValue = $limitValue;
178
- $countCharacter = (int) $countValue - (in_array($data->networkId, $this->allowHtml) ? (int) mb_strlen(strip_tags($message), 'UTF-8') : (int) mb_strlen($message, 'UTF-8'));
179
- if ($countCharacter <= 0) {
180
- $message = mb_substr($message, 0, (int) $countValue);
181
- $countCharacter = 0;
182
- }*/
183
184
$textareaLimitInfo = '<span class="b2s-post-item-countChar" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . '</span>';
185
$textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
@@ -211,6 +216,10 @@ class B2S_Ship_Item {
211
$content .= '<span class="hidden-xs b2s-post-item-details-message-info" data-network-auth-id="' . $data->networkAuthId . '">' . $messageInfo . '</span></span>';
212
213
$content .= '<div class="pull-right hidden-xs b2s-post-item-info-area">';
214
if (in_array($data->networkId, $this->getText)) {
215
$content .= '<button class="btn btn-xs btn-link b2s-post-ship-item-full-text" data-network-auth-id="' . $data->networkAuthId . '" >' . __('Insert full-text', 'blog2social') . '</button> | ';
216
}
@@ -221,7 +230,7 @@ class B2S_Ship_Item {
221
222
$content .= '<div class="b2s-post-item-details-edit-area" data-network-auth-id="' . $data->networkAuthId . '">';
223
$content .= in_array($data->networkId, $this->showBoards) ? $this->getBoardHtml($data->networkAuthId, $data->networkId) : '';
224
- $content .= (in_array($data->networkId, $this->showGroups) && $data->networkType == 2) ? $this->getGroupsHtml($data->networkAuthId, $data->networkId) : '';
225
$content .= ((in_array($data->networkId, $this->showTitleProfile) && $data->networkType == 0) || (in_array($data->networkId, $this->showTitlePage) && $data->networkType == 1) || (in_array($data->networkId, $this->showTitleGroup) && $data->networkType == 2)) ? $this->getTitleHtml($data->networkAuthId, $this->postData->post_title) : '';
226
$content .= $this->getCustomEditArea($data->networkId, $data->networkAuthId, $data->networkType, $message, $isRequiredTextarea, $textareaOnKeyUp, $limit, $limitValue);
227
$content .= (in_array($data->networkId, $this->allowTag)) ? $this->getTagsHtml($data->networkAuthId) : '';
@@ -246,12 +255,12 @@ class B2S_Ship_Item {
246
if (trim(strtolower($this->postStatus)) == 'publish') {
247
$meta = B2S_Util::getMetaTags($this->postId, $this->postUrl);
248
} else {
249
- $meta = array('title' => B2S_Util::getExcerpt($this->postData->post_title, 50) . ' - ' . $this->websiteName, 'description' => B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postData->post_content, false), 150));
250
}
251
}
252
if (is_array($meta) && !empty($meta)) {
253
if ($networkId == 1) {
254
- $edit = '<textarea class="form-control fb-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="'.$limitValue.'" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
255
$edit .= '<div class="fb-container">';
256
$edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="fb-url-image b2s-post-item-details-url-image" data-network-image-change="1" data-network-auth-id="' . $networkAuthId . '">';
257
$edit .= '<div class="fb-content">';
@@ -263,7 +272,7 @@ class B2S_Ship_Item {
263
}
264
265
if ($networkId == 3) {
266
- $edit = '<textarea class="form-control linkedin-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="'.$limitValue.'" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
267
$edit .= '<div class="linkedin-container">';
268
$edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="linkedin-url-image b2s-post-item-details-url-image" data-network-image-change="1" data-network-auth-id="' . $networkAuthId . '">';
269
$edit .= '<div class="linkedin-content">';
@@ -275,7 +284,7 @@ class B2S_Ship_Item {
275
}
276
277
if ($networkId == 8 && $networkType == 0) {
278
- $edit = '<textarea class="form-control xing-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="'.$limitValue.'" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
279
$edit .= '<div class="xing-container">';
280
$edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="xing-url-image b2s-post-item-details-url-image" data-network-image-change="0" data-network-auth-id="' . $networkAuthId . '">';
281
$edit .= '<div class="xing-content">';
@@ -286,7 +295,7 @@ class B2S_Ship_Item {
286
$edit .= '</div>';
287
}
288
} else {
289
- $edit = '<textarea class="form-control b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="'.$limitValue.'" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
290
$edit .= $this->getUrlHtml($networkId, $networkAuthId, $limit, $limitValue);
291
}
292
return $edit;
@@ -349,6 +358,11 @@ class B2S_Ship_Item {
349
return '<input type="text" name="b2s[' . $networkdAutId . '][custom_title]" class="form-control b2s-post-item-details-item-title-input" data-network-auth-id="' . $networkdAutId . '" placeholder="' . __('The Headline...', 'blog2social') . '" required="required" maxlength="254" value="' . $title . '" />';
350
}
351
352
private function getTagsHtml($networkAuthId) {
353
$tags = '<div class="b2s-post-item-details-tag-area">';
354
$tags .= '<div class="b2s-post-item-details-tag-title"> ' . __('Hashtags', 'blog2social') . ' </div>';
@@ -375,12 +389,15 @@ class B2S_Ship_Item {
375
}
376
377
private function getShippingTimeHtml($networkAuthId, $networkTyp, $networkId) {
378
- //$shipping = '<div class="b2s-post-item-details-release-choose">' . __('Schedule Publication', 'blog2social') . '</div>';
379
$shipping = '<br>';
380
$shipping .= '<select name="b2s[' . $networkAuthId . '][releaseSelect]" data-user-version="' . B2S_PLUGIN_USER_VERSION . '" data-network-type="' . $networkTyp . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" class="form-control b2s-select b2s-post-item-details-release-input-date-select ' . (B2S_PLUGIN_USER_VERSION == 0 ? 'b2s-post-item-details-release-input-date-select-reset' : '') . '" >';
381
- $shipping .= '<option value="0" selected="selected">' . __('Share Now', 'blog2social') . '</option>';
382
383
- $shipping .= '<option value="1">' . __('Schedule post once', 'blog2social') . '</option>';
384
if ($networkTyp != 2 && !in_array($networkId, $this->noScheduleRegularly)) {
385
$shipping .= '<option value="2">' . __('Schedule post recurrently', 'blog2social') . '</option>';
386
}
2
3
class B2S_Ship_Item {
4
5
+ private $allowTitleProfile = array(7, 9, 13, 15);
6
private $allowTitlePage = array();
7
private $allowTitleGroup = array();
8
private $isCommentProfile = array(1, 3, 8, 10);
9
private $isCommentPage = array();
10
+ private $isCommentGroup = array(1, 8);
11
private $allowTag = array(4, 9);
12
private $allowHtml = array(4, 11, 14);
13
private $showTitleProfile = array(4, 9, 11, 14);
15
private $showTitleGroup = array(8);
16
private $onlyImage = array(6, 7, 12);
17
private $allowNoImageProfile = array(5, 9);
18
+ private $allowNoCustomImageProfile = array(8, 15);
19
+ private $allowNoEmoji = array(3, 9, 13, 14, 15);
20
private $allowNoImagePage = array(8);
21
+ private $allowEditUrl = array(1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
22
private $showBoards = array(6);
23
+ private $showGroups = array(8, 15);
24
private $hideGroupName = array(8);
25
+ private $excludedImage = array(2);
26
private $setShortTextProfile = array(1 => 239, 2 => 116, 3 => 239, 6 => 300, 8 => 239, 10 => 442, 12 => 240, 9 => 200);
27
private $setShortTextPage = array(1 => 239, 3 => 239, 8 => 1200, 10 => 442);
28
+ private $setShortTextGroup = array(1 => 239, 8 => 239, 10 => 442);
29
private $allowHashTags = array(6, 10, 12);
30
+ private $limitCharacterProfile = array(2 => 140, 3 => 600, 6 => 500, 8 => 420, 9 => 250, 15 => 300);
31
private $limitCharacterPage = array(3 => 600, 8 => 1200);
32
+ private $requiredUrl = array(1, 3, 8, 9, 10, 15);
33
private $getText = array(1, 7, 10, 12);
34
+ private $showSettingsLink = array(1);
35
private $maxWeekTimeSelect = 52;
36
private $maxSchedCount = 3;
37
+ private $noScheduleRegularly = array(4, 11, 14, 15);
38
private $defaultImage;
39
private $postData;
40
private $postUrl;
41
private $postStatus;
72
$infoImage .= (in_array($data->networkId, $this->allowNoCustomImageProfile)) ? (!empty($infoImage) ? ' | ' : '') . __('Network defines image by link', 'blog2social') . '!' : '';
73
$htmlTags = highlight_string("<p><br><i><b><a><img>", true);
74
$infoImage .= (in_array($data->networkId, $this->allowHtml)) ? (!empty($infoImage) ? ' | ' : '') . __('Supported HTML tags', 'blog2social') . ': ' . $htmlTags : '';
75
+ $infoImage .= (in_array($data->networkId, $this->allowNoEmoji)) ? (!empty($infoImage) ? ' | ' : '') . __('Network does not support emojis', 'blog2social') . '!' : '';
76
77
$network_display_name = $data->network_display_name;
78
$isRequiredTextarea = (in_array($data->networkId, $this->isCommentProfile)) ? '' : 'required="required"';
79
80
//ShortText
81
if (isset($this->setShortTextProfile[$data->networkId]) && (int) $this->setShortTextProfile[$data->networkId] > 0) {
82
+ $preContent = ($data->networkId == 2) ? $this->postData->post_title : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true));
83
$message = B2S_Util::getExcerpt($preContent, (int) $this->setShortTextProfile[$data->networkId]);
84
} else {
85
+ $message = (in_array($data->networkId, $this->allowTitleProfile) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte($this->postData->post_title) :$this->postData->post_title) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true)));
86
}
87
88
//Hashtags
103
} */
104
105
$infoCharacterCount = ($data->networkId != 2) ? ' (' . __('Text only', 'blog2social') . ')' : '';
106
+ if (in_array($data->networkId, $this->excludedImage)) {
107
+ $textareaLimitInfo .= $this->excludedImageTransferHtml($data->networkId, $data->networkAuthId, $limitValue);
108
+ }
109
+ $textareaLimitInfo .= '<span class="b2s-post-item-countChar" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . $infoCharacterCount . '</span>';
110
$textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
111
} else {
112
//$countCharacter = in_array($data->networkId, $this->allowHtml) ? (int) mb_strlen(strip_tags($message), 'UTF-8') : (int) mb_strlen($message, 'UTF-8');
122
$limit = true;
123
}
124
$infoImage = (in_array($data->networkId, $this->allowNoImagePage)) ? __('Network does not support image for pages', 'blog2social') . '!' : '';
125
+ $infoImage .= (in_array($data->networkId, $this->allowNoEmoji)) ? (!empty($infoImage) ? ' | ' : '') . __('Network does not support emojis', 'blog2social') . '!' : '';
126
127
//ShortText
128
if (isset($this->setShortTextPage[$data->networkId]) && (int) $this->setShortTextPage[$data->networkId] > 0) {
129
if ($data->networkId == 8) { //Xing -1 Leerzeichen
130
$this->setShortTextPage[$data->networkId] = (int) $this->setShortTextPage[$data->networkId] - mb_strlen($this->postUrl, 'UTF-8') - 1;
131
}
132
+ $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false: true)), (int) $this->setShortTextPage[$data->networkId]);
133
} else {
134
+ $message = (in_array($data->networkId, $this->allowTitlePage) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte($this->postData->post_title) :$this->postData->post_title) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false: true)));
135
}
136
137
//Hashtags
144
145
$countCharacter = 0;
146
if ($limit !== false) {
147
+ /* $countValue = $limitValue;
148
+ if ($data->networkId == 8) { //Xing -1 Leerzeichen
149
+ $countValue = $limitValue - mb_strlen($this->postUrl, 'UTF-8') - 1;
150
+ }
151
+ $countCharacter = (int) $countValue - (in_array($data->networkId, $this->allowHtml) ? (int) mb_strlen(strip_tags($message), 'UTF-8') : (int) mb_strlen($message, 'UTF-8'));
152
+ if ($countCharacter <= 0) {
153
+ $message = mb_substr($message, 0, (int) $countValue);
154
+ $countCharacter = 0;
155
+ } */
156
157
$textareaLimitInfo = '<span class="b2s-post-item-countChar" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . '</span>';
158
$textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
166
//group
167
//ShortText
168
if (isset($this->setShortTextGroup[$data->networkId]) && (int) $this->setShortTextGroup[$data->networkId] > 0) {
169
+ $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false: true)), (int) $this->setShortTextGroup[$data->networkId]);
170
} else {
171
+ $message = (in_array($data->networkId, $this->allowTitleGroup) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte($this->postData->post_title) :$this->postData->post_title) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false: true)));
172
}
173
//Hashtags
174
if (in_array($data->networkId, $this->allowHashTags)) {
179
180
$countCharacter = 0;
181
if ($limit !== false) {
182
+ /* $countValue = $limitValue;
183
+ $countCharacter = (int) $countValue - (in_array($data->networkId, $this->allowHtml) ? (int) mb_strlen(strip_tags($message), 'UTF-8') : (int) mb_strlen($message, 'UTF-8'));
184
+ if ($countCharacter <= 0) {
185
+ $message = mb_substr($message, 0, (int) $countValue);
186
+ $countCharacter = 0;
187
+ } */
188
189
$textareaLimitInfo = '<span class="b2s-post-item-countChar" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . '</span>';
190
$textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
216
$content .= '<span class="hidden-xs b2s-post-item-details-message-info" data-network-auth-id="' . $data->networkAuthId . '">' . $messageInfo . '</span></span>';
217
218
$content .= '<div class="pull-right hidden-xs b2s-post-item-info-area">';
219
+
220
+ if (in_array($data->networkId, $this->showSettingsLink)) {
221
+ $content .= $this->getSettingsLinkHtml();
222
+ }
223
if (in_array($data->networkId, $this->getText)) {
224
$content .= '<button class="btn btn-xs btn-link b2s-post-ship-item-full-text" data-network-auth-id="' . $data->networkAuthId . '" >' . __('Insert full-text', 'blog2social') . '</button> | ';
225
}
230
231
$content .= '<div class="b2s-post-item-details-edit-area" data-network-auth-id="' . $data->networkAuthId . '">';
232
$content .= in_array($data->networkId, $this->showBoards) ? $this->getBoardHtml($data->networkAuthId, $data->networkId) : '';
233
+ $content .= (in_array($data->networkId, $this->showGroups) && ($data->networkType == 2 || $data->networkId == 15)) ? $this->getGroupsHtml($data->networkAuthId, $data->networkId) : '';
234
$content .= ((in_array($data->networkId, $this->showTitleProfile) && $data->networkType == 0) || (in_array($data->networkId, $this->showTitlePage) && $data->networkType == 1) || (in_array($data->networkId, $this->showTitleGroup) && $data->networkType == 2)) ? $this->getTitleHtml($data->networkAuthId, $this->postData->post_title) : '';
235
$content .= $this->getCustomEditArea($data->networkId, $data->networkAuthId, $data->networkType, $message, $isRequiredTextarea, $textareaOnKeyUp, $limit, $limitValue);
236
$content .= (in_array($data->networkId, $this->allowTag)) ? $this->getTagsHtml($data->networkAuthId) : '';
255
if (trim(strtolower($this->postStatus)) == 'publish') {
256
$meta = B2S_Util::getMetaTags($this->postId, $this->postUrl);
257
} else {
258
+ $meta = array('title' => B2S_Util::getExcerpt($this->postData->post_title, 50) . ' - ' . $this->websiteName, 'description' => B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($networkId, $this->allowNoEmoji) ? false: true)), 150));
259
}
260
}
261
if (is_array($meta) && !empty($meta)) {
262
if ($networkId == 1) {
263
+ $edit = '<textarea class="form-control fb-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="' . $limitValue . '" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
264
$edit .= '<div class="fb-container">';
265
$edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="fb-url-image b2s-post-item-details-url-image" data-network-image-change="1" data-network-auth-id="' . $networkAuthId . '">';
266
$edit .= '<div class="fb-content">';
272
}
273
274
if ($networkId == 3) {
275
+ $edit = '<textarea class="form-control linkedin-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="' . $limitValue . '" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
276
$edit .= '<div class="linkedin-container">';
277
$edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="linkedin-url-image b2s-post-item-details-url-image" data-network-image-change="1" data-network-auth-id="' . $networkAuthId . '">';
278
$edit .= '<div class="linkedin-content">';
284
}
285
286
if ($networkId == 8 && $networkType == 0) {
287
+ $edit = '<textarea class="form-control xing-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="' . $limitValue . '" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
288
$edit .= '<div class="xing-container">';
289
$edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="xing-url-image b2s-post-item-details-url-image" data-network-image-change="0" data-network-auth-id="' . $networkAuthId . '">';
290
$edit .= '<div class="xing-content">';
295
$edit .= '</div>';
296
}
297
} else {
298
+ $edit = '<textarea class="form-control b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '" data-network-text-limit="' . $limitValue . '" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
299
$edit .= $this->getUrlHtml($networkId, $networkAuthId, $limit, $limitValue);
300
}
301
return $edit;
358
return '<input type="text" name="b2s[' . $networkdAutId . '][custom_title]" class="form-control b2s-post-item-details-item-title-input" data-network-auth-id="' . $networkdAutId . '" placeholder="' . __('The Headline...', 'blog2social') . '" required="required" maxlength="254" value="' . $title . '" />';
359
}
360
361
+ private function getSettingsLinkHtml() {
362
+ $b2sNetworkSettingsLink = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=blog2social-settings&show=b2s-network';
363
+ return '<a href="' . $b2sNetworkSettingsLink . '" class="btn btn-xs btn-link b2s-post-ship-item-network-settings" target="_blank">' . __('Settings', 'blog2social') . '</a> | ';
364
+ }
365
+
366
private function getTagsHtml($networkAuthId) {
367
$tags = '<div class="b2s-post-item-details-tag-area">';
368
$tags .= '<div class="b2s-post-item-details-tag-title"> ' . __('Hashtags', 'blog2social') . ' </div>';
389
}
390
391
private function getShippingTimeHtml($networkAuthId, $networkTyp, $networkId) {
392
+
393
+ $isSelectedSched = (B2S_PLUGIN_USER_VERSION > 0 && trim(strtolower($this->postStatus)) == 'future') ? 'selected="selected"' : '';
394
+ $isSelectedNow = (empty($isSelectedSched)) ? 'selected="selected"' : '';
395
+
396
$shipping = '<br>';
397
$shipping .= '<select name="b2s[' . $networkAuthId . '][releaseSelect]" data-user-version="' . B2S_PLUGIN_USER_VERSION . '" data-network-type="' . $networkTyp . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" class="form-control b2s-select b2s-post-item-details-release-input-date-select ' . (B2S_PLUGIN_USER_VERSION == 0 ? 'b2s-post-item-details-release-input-date-select-reset' : '') . '" >';
398
+ $shipping .= '<option value="0" ' . $isSelectedNow . '>' . __('Share Now', 'blog2social') . '</option>';
399
400
+ $shipping .= '<option value="1" ' . $isSelectedSched . '>' . __('Schedule post once', 'blog2social') . '</option>';
401
if ($networkTyp != 2 && !in_array($networkId, $this->noScheduleRegularly)) {
402
$shipping .= '<option value="2">' . __('Schedule post recurrently', 'blog2social') . '</option>';
403
}
includes/B2S/Ship/Navbar.php CHANGED
@@ -21,7 +21,7 @@ class B2S_Ship_Navbar {
21
}
22
23
public function getData() {
24
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getUserAuth', 'token' => B2S_PLUGIN_TOKEN)));
25
return array('mandanten' => isset($result->mandanten) ? $result->mandanten : '',
26
'auth' => isset($result->auth) ? $result->auth : '',
27
'portale' => isset($result->portale) ? $result->portale : '');
21
}
22
23
public function getData() {
24
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getUserAuth', 'token' => B2S_PLUGIN_TOKEN,'version'=>B2S_PLUGIN_VERSION)));
25
return array('mandanten' => isset($result->mandanten) ? $result->mandanten : '',
26
'auth' => isset($result->auth) ? $result->auth : '',
27
'portale' => isset($result->portale) ? $result->portale : '');
includes/B2S/Ship/Save.php CHANGED
@@ -102,6 +102,18 @@ class B2S_Ship_Save {
102
unset($serializeData['post_id']);
103
unset($serializeData['image']);
104
105
$wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($serializeData), 'image_url' => $data['image_url']), array('%s', '%s'));
106
$schedDetailsId = $wpdb->insert_id;
107
$schedDate = 0;
@@ -136,7 +148,7 @@ class B2S_Ship_Save {
136
$sendDay = (7 * ($weeks - 1));
137
} else {
138
$sendDay = $dayNumber - $startDay + (7 * ($weeks - 1));
139
- }
140
if ($schedData['weeks'][$schedcycle] == 1 || $sendDay <= $maxDaysSched) {
141
$schedTime = date('Y-m-d', strtotime("+$sendDay days", strtotime($startTime)));
142
$tempSchedDateTime = date('Y-m-d H:i:00', strtotime($schedTime . ' ' . $schedData['time'][$schedcycle]));
102
unset($serializeData['post_id']);
103
unset($serializeData['image']);
104
105
+
106
+ //Remove Emoji by Schedule
107
+ if (isset($serializeData['default_titel']) && !empty($serializeData['default_titel'])) {
108
+ $serializeData['default_titel'] = B2S_Util::remove4byte($serializeData['default_titel']);
109
+ }
110
+ if (isset($serializeData['custom_title']) && !empty($serializeData['custom_title'])) {
111
+ $serializeData['custom_title'] = B2S_Util::remove4byte($serializeData['custom_title']);
112
+ }
113
+ if (isset($serializeData['content']) && !empty($serializeData['content'])) {
114
+ $serializeData['content'] = B2S_Util::remove4byte($serializeData['content']);
115
+ }
116
+
117
$wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($serializeData), 'image_url' => $data['image_url']), array('%s', '%s'));
118
$schedDetailsId = $wpdb->insert_id;
119
$schedDate = 0;
148
$sendDay = (7 * ($weeks - 1));
149
} else {
150
$sendDay = $dayNumber - $startDay + (7 * ($weeks - 1));
151
+ }
152
if ($schedData['weeks'][$schedcycle] == 1 || $sendDay <= $maxDaysSched) {
153
$schedTime = date('Y-m-d', strtotime("+$sendDay days", strtotime($startTime)));
154
$tempSchedDateTime = date('Y-m-d H:i:00', strtotime($schedTime . ' ' . $schedData['time'][$schedcycle]));
includes/Init.php CHANGED
@@ -34,13 +34,13 @@ class B2S_Init {
34
define('B2S_PLUGIN_PRG_API_ENDPOINT', 'http://developer.pr-gateway.de/wp/v3/');
35
define('B2S_PLUGIN_SERVER_URL', 'https://developer.blog2social.com');
36
define('B2S_PLUGIN_VERSION_TYPE', serialize(array(0 => 'Free', 1 => 'PRO', 2 => 'Business', 3 => 'Premium', 7 => 'PRO', 8 => 'PRO', 9 => 'Business', 10 => 'Premium', 11 => 'Smart')));
37
- define('B2S_PLUGIN_NETWORK', serialize(array(1 => 'Facebook', 2 => 'Twitter', 3 => 'Linkedin', 4 => 'Tumblr', 5 => 'Storify', 6 => 'Pinterest', 7 => 'Flickr', 8 => 'Xing', 9 => 'Diigo', 10 => 'Google+', 11 => 'Medium', 12 => 'Instagram', 13 => 'Delicious', 14 => 'Torial')));
38
- define('B2S_PLUGIN_SCHED_DEFAULT_TIMES', serialize(array(1 => array(18, 22), 2 => array(8, 10), 3 => array(8, 10), 4 => array(16, 22), 5 => array(), 6 => array(19, 22), 7 => array(7, 9), 8 => array(7, 10), 9 => array(16, 19), 10 => array(7, 10), 11 => array(16, 19), 12 => array(19, 22), 13 => array(11, 13), 14 => array(18, 22))));
39
- define('B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO', serialize(array(1 => array(0 => array(13, 16), 1 => array(18, 22)), 2 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 3 => array(0 => array(8, 10), 1 => array(16, 18)), 4 => array(), 5 => array(), 6 => array(0 => array(12, 14), 1 => array(19, 22)), 7 => array(0 => array(7, 9), 1 => array(17, 19)), 8 => array(0 => array(7, 10), 1 => array(17, 18)), 9 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 10 => array(0 => array(7, 10), 1 => array(14, 15)), 11 => array(), 12 => array(0 => array(12, 14), 1 => array(19, 22)), 13 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 14 => array())));
40
- define('B2S_PLUGIN_NETWORK_ALLOW_PROFILE', serialize(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)));
41
define('B2S_PLUGIN_NETWORK_ALLOW_PAGE', serialize(array(1, 3, 8, 10)));
42
- define('B2S_PLUGIN_NETWORK_ALLOW_GROUP', serialize(array(8, 10)));
43
- define('B2S_PLUGIN_NETWORK_OAUTH', serialize(array(1, 2, 3, 4, 7, 8, 11)));
44
define('B2S_PLUGIN_BLOG_USER_ID', get_current_user_id());
45
define('B2S_PLUGIN_ADMIN', current_user_can('administrator'));
46
$this->blogUserData = get_userdata(B2S_PLUGIN_BLOG_USER_ID);
@@ -51,9 +51,9 @@ class B2S_Init {
51
add_filter('heartbeat_received', array(B2S_Heartbeat::getInstance(), 'init'), 10, 2);
52
add_action('admin_notices', array('B2S_Notice', 'getProVersionNotice'));
53
add_action('admin_notices', array($this, 'b2s_save_post_alert_meta_box'));
54
- add_filter('plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'plugin_activate_sublink'));
55
add_action('add_meta_boxes', array($this, 'b2s_init_meta_box'));
56
add_action('save_post', array($this, 'b2s_save_meta_box'));
57
58
Ajax_Get::getInstance();
59
Ajax_Post::getInstance();
@@ -61,9 +61,20 @@ class B2S_Init {
61
$this->getToken();
62
$this->getUserDetails();
63
}
64
$this->plugin_init_language();
65
}
66
67
public function b2s_init_meta_box() {
68
$post_types = get_post_types(array('public' => true));
69
if (is_array($post_types) && !empty($post_types)) {
@@ -89,9 +100,10 @@ class B2S_Init {
89
}
90
91
public function b2s_save_meta_box() {
92
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']) && isset($_POST['b2s-post-meta-box-time-dropdown'])) {
93
if (strtolower($_POST['b2s-post-meta-box-time-dropdown']) == 'publish') {
94
- if (strtolower($_POST['post_status']) == "publish" && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
95
$profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
96
if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
97
$networkData = unserialize(stripslashes($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
@@ -99,12 +111,18 @@ class B2S_Init {
99
$user_timezone = isset($_POST['b2s-user-timezone']) ? $_POST['b2s-user-timezone'] : 0;
100
$current_user_date = (isset($_POST['b2s-user-publish-date']) && strtotime($_POST['b2s-user-publish-date']) !== false) ? date('Y-m-d H:i:s', strtotime($_POST['b2s-user-publish-date'])) : date('Y-m-d H:i:s', current_time('timestamp'));
101
102
- //WP User Sched Post
103
$post_date = '';
104
if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
105
$post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
106
}
107
108
//ShareNow
109
$sched_type = 3;
110
$sched_date = $current_user_date;
@@ -141,18 +159,19 @@ class B2S_Init {
141
}
142
}
143
144
$image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
145
$keywords = get_the_tags((int) $_POST['post_ID']);
146
$url = get_permalink($_POST['post_ID']);
147
$title = isset($_POST['post_title']) ? trim(addslashes(strip_tags($_POST['post_title']))) : '';
148
$content = (isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : '';
149
- $defaultPostData = array('default_titel' => strip_tags($title),
150
'image_url' => ($image_url !== false) ? trim($image_url) : '',
151
'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
152
'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $user_timezone); // 'publish_date' => $sched_date, OLD FOR Share Now?
153
154
$defaultBlogPostData = array('post_id' => (int) $_POST['post_ID'], 'blog_user_id' => (int) $_POST['user_ID'], 'user_timezone' => $user_timezone, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
155
- $autoShare = new B2S_AutoShare($defaultBlogPostData, $current_user_date, $myTimeSettings, $title, $content, $url, $image_url, $keywords);
156
define('B2S_SAVE_META_BOX_AUTO_SHARE', $_POST['post_ID']);
157
if (isset($_POST['b2s-user-last-selected-profile-id']) && (int) $_POST['b2s-user-last-selected-profile-id'] != (int) $_POST['b2s-post-meta-box-profil-dropdown'] && (int) $_POST['b2s-post-meta-box-profil-dropdown'] != 0) {
158
update_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . $_POST['user_ID'], (int) $_POST['b2s-post-meta-box-profil-dropdown']);
@@ -207,10 +226,11 @@ class B2S_Init {
207
if (isset($_GET['b2s_action'])) {
208
$b2sAction = $_GET['b2s_action'];
209
if ((int) $b2sAction == 1) {
210
if (isset($_GET['b2s_update_publish_date']) && !empty($_GET['b2s_update_publish_date'])) {
211
- echo '<div class="updated"><p>' . __('Now, your post will be shared on social media since', 'blog2social') . ' ' . $_GET['b2s_update_publish_date'] . '</p></div>';
212
} else {
213
- echo '<div class="updated"><p>' . __('Now, your post will be shared on social media in 2-3 minutes!', 'blog2social') . '</p></div>';
214
}
215
}
216
if ((int) $b2sAction == 2) {
@@ -228,8 +248,11 @@ class B2S_Init {
228
}
229
230
public function plugin_activate_sublink($links) {
231
- $added_link = array('<a target="_blank" style="color: rgba(10, 154, 62, 1); font-weight: bold; font-size: 13px;" href="' . __('https://www.blog2social.com/en/pricing/', 'blog2social') . '">' . __('Upgrade to Premium', 'blog2social') . '</a>');
232
- return array_merge($added_link, $links);
233
}
234
235
public function defineText() {
@@ -242,7 +265,12 @@ class B2S_Init {
242
'LIMIT' => __('Your limit is reached for today.', 'blog2social'),
243
'IMAGE' => __('Your post could not be posted, because your image is not available.', 'blog2social'),
244
'PROTECT' => __('The network has blocked your account. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
245
- 'IMAGE_LIMIT' => __('The number of images is reached. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'))));
246
}
247
248
public function getToken() {
@@ -289,6 +317,7 @@ class B2S_Init {
289
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 8);
290
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
291
curl_setopt($ch, CURLOPT_CAINFO, B2S_PLUGIN_DIR . "/includes/cacert.pem");
292
$currentVersion = explode('#', curl_exec($ch));
293
$b2sUpdate = (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) ? 1 : 0; //1=InfoUpdate
294
define('B2S_PLUGIN_UPATE', $b2sUpdate);
@@ -468,48 +497,48 @@ class B2S_Init {
468
}
469
470
public function registerAssets() {
471
- wp_register_style('B2SBOOTCSS', plugins_url('assets/css/general.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
472
- wp_register_style('B2SSTARTCSS', plugins_url('assets/css/b2s/start.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
473
- wp_register_style('B2SPOSTCSS', plugins_url('assets/css/b2s/post.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
474
- wp_register_style('B2SSHIPCSS', plugins_url('assets/css/b2s/ship.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
475
- wp_register_style('B2SPOSTSCHEDCSS', plugins_url('assets/css/b2s/post.sched.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
476
- wp_register_style('B2SPOSTPUBLISHCSS', plugins_url('assets/css/b2s/post.publish.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
477
- wp_register_style('B2SNETWORKCSS', plugins_url('assets/css/b2s/network.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
478
- wp_register_style('B2SSETTINGSCSS', plugins_url('assets/css/b2s/settings.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
479
- wp_register_style('PRGSHIPCSS', plugins_url('assets/css/prg/ship.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
480
- wp_register_style('PRGLOGINCSS', plugins_url('assets/css/prg/login.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
481
- wp_register_style('B2SDATEPICKERCSS', plugins_url('assets/lib/datepicker/css/bootstrap-datepicker3.min.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
482
- wp_register_style('B2SAIRDATEPICKERCSS', plugins_url('assets/lib/air-datepicker/css/datepicker.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
483
- wp_register_style('B2STIMEPICKERCSS', plugins_url('assets/lib/timepicker/timepicker.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
484
- wp_register_style('PRGPOSTCSS', plugins_url('assets/css/prg/post.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
485
- wp_register_style('B2SWYSIWYGCSS', plugins_url('assets/lib/wysiwyg/square.min.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
486
- wp_register_style('B2SMETABOXCSS', plugins_url('assets/css/b2s/wp/post-meta-box.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
487
- wp_register_style('B2SNOTICECSS', plugins_url('assets/css/notice.css', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
488
-
489
- wp_register_script('B2SNETWORKJS', plugins_url('assets/js/b2s/network.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
490
- wp_register_script('B2SSETTINGSJS', plugins_url('assets/js/b2s/settings.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
491
- wp_register_script('B2SSTARTJS', plugins_url('assets/js/b2s/start.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
492
- wp_register_script('B2SPOSTJS', plugins_url('assets/js/b2s/post.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
493
- wp_register_script('B2SSHIPJS', plugins_url('assets/js/b2s/ship.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
494
- wp_register_script('PRGSHIPJS', plugins_url('assets/js/prg/ship.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
495
- wp_register_script('PRGLOGINJS', plugins_url('assets/js/prg/login.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
496
- wp_register_script('B2SBOOTJS', plugins_url('assets/js/general.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
497
- wp_register_script('B2SVALIDATEJS', plugins_url('assets/js/validate.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
498
- wp_register_script('B2SGENERALJS', plugins_url('assets/js/b2s/general.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
499
- wp_register_script('B2SDATEPICKERJS', plugins_url('assets/lib/datepicker/js/bootstrap-datepicker.min.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
500
- wp_register_script('B2SDATEPICKERDEJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.de_DE.min.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
501
- wp_register_script('B2SDATEPICKERENJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.en_US.min.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
502
- wp_register_script('B2SAIRDATEPICKERJS', plugins_url('assets/lib/air-datepicker/js/datepicker.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
503
- wp_register_script('B2SAIRDATEPICKERDEJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.de.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
504
- wp_register_script('B2SAIRDATEPICKERENJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.en.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
505
- wp_register_script('B2STIMEPICKERJS', plugins_url('assets/lib/timepicker/timepicker.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
506
- wp_register_script('B2SNOTICEJS', plugins_url('assets/js/notice.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
507
- wp_register_script('PRGPOSTJS', plugins_url('assets/js/prg/post.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
508
- wp_register_script('PRGGENERALJS', plugins_url('assets/js/prg/general.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
509
- wp_register_script('B2SWYSIWYGJS', plugins_url('assets/lib/wysiwyg/jquery.sceditor.xhtml.min.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
510
- wp_register_script('B2SWYSIWYGLANGDEJS', plugins_url('assets/lib/wysiwyg/languages/de.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
511
- wp_register_script('B2SWYSIWYGLANGENJS', plugins_url('assets/lib/wysiwyg/languages/en.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
512
- wp_register_script('B2SMETABOXJS', plugins_url('assets/js/b2s/wp/post-meta-box.js', B2S_PLUGIN_FILE),array(),B2S_PLUGIN_VERSION);
513
}
514
515
public function activatePlugin() {
34
define('B2S_PLUGIN_PRG_API_ENDPOINT', 'http://developer.pr-gateway.de/wp/v3/');
35
define('B2S_PLUGIN_SERVER_URL', 'https://developer.blog2social.com');
36
define('B2S_PLUGIN_VERSION_TYPE', serialize(array(0 => 'Free', 1 => 'PRO', 2 => 'Business', 3 => 'Premium', 7 => 'PRO', 8 => 'PRO', 9 => 'Business', 10 => 'Premium', 11 => 'Smart')));
37
+ define('B2S_PLUGIN_NETWORK', serialize(array(1 => 'Facebook', 2 => 'Twitter', 3 => 'Linkedin', 4 => 'Tumblr', 5 => 'Storify', 6 => 'Pinterest', 7 => 'Flickr', 8 => 'Xing', 9 => 'Diigo', 10 => 'Google+', 11 => 'Medium', 12 => 'Instagram', 13 => 'Delicious', 14 => 'Torial', 15 => 'Reddit')));
38
+ define('B2S_PLUGIN_SCHED_DEFAULT_TIMES', serialize(array(1 => array(18, 22), 2 => array(8, 10), 3 => array(8, 10), 4 => array(16, 22), 5 => array(), 6 => array(19, 22), 7 => array(7, 9), 8 => array(7, 10), 9 => array(16, 19), 10 => array(7, 10), 11 => array(16, 19), 12 => array(19, 22), 13 => array(11, 13), 14 => array(18, 22), 15 => array(8, 11))));
39
+ define('B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO', serialize(array(1 => array(0 => array(13, 16), 1 => array(18, 22)), 2 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 3 => array(0 => array(8, 10), 1 => array(16, 18)), 4 => array(), 5 => array(), 6 => array(0 => array(12, 14), 1 => array(19, 22)), 7 => array(0 => array(7, 9), 1 => array(17, 19)), 8 => array(0 => array(7, 10), 1 => array(17, 18)), 9 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 10 => array(0 => array(7, 10), 1 => array(14, 15)), 11 => array(), 12 => array(0 => array(12, 14), 1 => array(19, 22)), 13 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 14 => array(), 15 => array(0 => array(8, 11)))));
40
+ define('B2S_PLUGIN_NETWORK_ALLOW_PROFILE', serialize(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)));
41
define('B2S_PLUGIN_NETWORK_ALLOW_PAGE', serialize(array(1, 3, 8, 10)));
42
+ define('B2S_PLUGIN_NETWORK_ALLOW_GROUP', serialize(array(1, 8, 10)));
43
+ define('B2S_PLUGIN_NETWORK_OAUTH', serialize(array(1, 2, 3, 4, 7, 8, 11, 15)));
44
define('B2S_PLUGIN_BLOG_USER_ID', get_current_user_id());
45
define('B2S_PLUGIN_ADMIN', current_user_can('administrator'));
46
$this->blogUserData = get_userdata(B2S_PLUGIN_BLOG_USER_ID);
51
add_filter('heartbeat_received', array(B2S_Heartbeat::getInstance(), 'init'), 10, 2);
52
add_action('admin_notices', array('B2S_Notice', 'getProVersionNotice'));
53
add_action('admin_notices', array($this, 'b2s_save_post_alert_meta_box'));
54
add_action('add_meta_boxes', array($this, 'b2s_init_meta_box'));
55
add_action('save_post', array($this, 'b2s_save_meta_box'));
56
+ add_filter('wp_footer', array($this, 'b2s_get_full_content'), 99); //for shortcodes
57
58
Ajax_Get::getInstance();
59
Ajax_Post::getInstance();
61
$this->getToken();
62
$this->getUserDetails();
63
}
64
+
65
+ add_filter('plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'plugin_activate_sublink'));
66
+
67
$this->plugin_init_language();
68
}
69
70
+ public function b2s_get_full_content() {
71
+ if (isset($_GET['b2s_get_full_content'])) {
72
+ $b2sPostContent = do_shortcode(get_the_content());
73
+ $b2sPostId = get_the_ID();
74
+ update_option('B2S_PLUGIN_POST_CONTENT_' . $b2sPostId, $b2sPostContent);
75
+ }
76
+ }
77
+
78
public function b2s_init_meta_box() {
79
$post_types = get_post_types(array('public' => true));
80
if (is_array($post_types) && !empty($post_types)) {
100
}
101
102
public function b2s_save_meta_box() {
103
+
104
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']) && isset($_POST['b2s-post-meta-box-time-dropdown'])) {
105
if (strtolower($_POST['b2s-post-meta-box-time-dropdown']) == 'publish') {
106
+ if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
107
$profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
108
if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
109
$networkData = unserialize(stripslashes($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
111
$user_timezone = isset($_POST['b2s-user-timezone']) ? $_POST['b2s-user-timezone'] : 0;
112
$current_user_date = (isset($_POST['b2s-user-publish-date']) && strtotime($_POST['b2s-user-publish-date']) !== false) ? date('Y-m-d H:i:s', strtotime($_POST['b2s-user-publish-date'])) : date('Y-m-d H:i:s', current_time('timestamp'));
113
114
+ //WP User Sched Post + B2S Share NOW FRIST SAVE
115
$post_date = '';
116
if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
117
$post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
118
}
119
120
+ //WP User Sched Post + B2S Share NOW SECOND SAVE
121
+ if (empty($post_date) && strtolower($_POST['post_status']) == "future" && isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
122
+ $wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
123
+ $post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
124
+ }
125
+
126
//ShareNow
127
$sched_type = 3;
128
$sched_date = $current_user_date;
159
}
160
}
161
162
+ delete_option('B2S_PLUGIN_POST_CONTENT_' . (int) $_POST['post_ID']);
163
$image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
164
$keywords = get_the_tags((int) $_POST['post_ID']);
165
$url = get_permalink($_POST['post_ID']);
166
$title = isset($_POST['post_title']) ? trim(addslashes(strip_tags($_POST['post_title']))) : '';
167
$content = (isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : '';
168
+ $defaultPostData = array('default_titel' => strip_tags(B2S_Util::remove4byte($title)),//Remove Emoji by Schedule
169
'image_url' => ($image_url !== false) ? trim($image_url) : '',
170
'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
171
'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $user_timezone); // 'publish_date' => $sched_date, OLD FOR Share Now?
172
173
$defaultBlogPostData = array('post_id' => (int) $_POST['post_ID'], 'blog_user_id' => (int) $_POST['user_ID'], 'user_timezone' => $user_timezone, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
174
+ $autoShare = new B2S_AutoShare((int) $_POST['post_ID'], $defaultBlogPostData, $current_user_date, $myTimeSettings, $title, $content, $url, $image_url, $keywords);
175
define('B2S_SAVE_META_BOX_AUTO_SHARE', $_POST['post_ID']);
176
if (isset($_POST['b2s-user-last-selected-profile-id']) && (int) $_POST['b2s-user-last-selected-profile-id'] != (int) $_POST['b2s-post-meta-box-profil-dropdown'] && (int) $_POST['b2s-post-meta-box-profil-dropdown'] != 0) {
177
update_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . $_POST['user_ID'], (int) $_POST['b2s-post-meta-box-profil-dropdown']);
226
if (isset($_GET['b2s_action'])) {
227
$b2sAction = $_GET['b2s_action'];
228
if ((int) $b2sAction == 1) {
229
+ $b2sLink = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=';
230
if (isset($_GET['b2s_update_publish_date']) && !empty($_GET['b2s_update_publish_date'])) {
231
+ echo '<div class="updated"><p>' . __('This post will be shared into your social media on', 'blog2social') . ' ' . $_GET['b2s_update_publish_date'] . ' <a target="_blank" href="' . $b2sLink . 'blog2social-sched">' . __('show details', 'blog2social') . '</a></p></div>';
232
} else {
233
+ echo '<div class="updated"><p>' . __('This post will be shared on social media in 2-3 minutes!', 'blog2social') . ' <a target="_blank" href="' . $b2sLink . 'blog2social-publish">' . __('show details', 'blog2social') . '</a></p></div>';
234
}
235
}
236
if ((int) $b2sAction == 2) {
248
}
249
250
public function plugin_activate_sublink($links) {
251
+ if (defined("B2S_PLUGIN_USER_VERSION") && B2S_PLUGIN_USER_VERSION == 0) {
252
+ $added_link = array('<a target="_blank" style="color: rgba(10, 154, 62, 1); font-weight: bold; font-size: 13px;" href="' . __('https://www.blog2social.com/en/pricing/', 'blog2social') . '">' . __('Upgrade to Premium', 'blog2social') . '</a>');
253
+ return array_merge($added_link, $links);
254
+ }
255
+ return $links;
256
}
257
258
public function defineText() {
265
'LIMIT' => __('Your limit is reached for today.', 'blog2social'),
266
'IMAGE' => __('Your post could not be posted, because your image is not available.', 'blog2social'),
267
'PROTECT' => __('The network has blocked your account. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
268
+ 'IMAGE_LIMIT' => __('The number of images is reached. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
269
+ 'RATE_LIMIT' => __('Your limit has temporarily reached for this network.', 'blog2social'),
270
+ 'INVALID_CONTENT' => __('The network can not publish special characters such as Emoji. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
271
+ 'EXISTS_CONTENT' => __('Your post is a duplicate.', 'blog2social'),
272
+ 'URL_CONTENT' => __('The network are required a public url to your post.', 'blog2social'),
273
+ 'GROUP_CONTENT' => __('The network says, that your group is not exisits.', 'blog2social'))));
274
}
275
276
public function getToken() {
317
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 8);
318
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
319
curl_setopt($ch, CURLOPT_CAINFO, B2S_PLUGIN_DIR . "/includes/cacert.pem");
320
+ curl_setopt($ch, CURLOPT_USERAGENT, "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)");
321
$currentVersion = explode('#', curl_exec($ch));
322
$b2sUpdate = (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) ? 1 : 0; //1=InfoUpdate
323
define('B2S_PLUGIN_UPATE', $b2sUpdate);
497
}
498
499
public function registerAssets() {
500
+ wp_register_style('B2SBOOTCSS', plugins_url('assets/css/general.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
501
+ wp_register_style('B2SSTARTCSS', plugins_url('assets/css/b2s/start.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
502
+ wp_register_style('B2SPOSTCSS', plugins_url('assets/css/b2s/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
503
+ wp_register_style('B2SSHIPCSS', plugins_url('assets/css/b2s/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
504
+ wp_register_style('B2SPOSTSCHEDCSS', plugins_url('assets/css/b2s/post.sched.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
505
+ wp_register_style('B2SPOSTPUBLISHCSS', plugins_url('assets/css/b2s/post.publish.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
506
+ wp_register_style('B2SNETWORKCSS', plugins_url('assets/css/b2s/network.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
507
+ wp_register_style('B2SSETTINGSCSS', plugins_url('assets/css/b2s/settings.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
508
+ wp_register_style('PRGSHIPCSS', plugins_url('assets/css/prg/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
509
+ wp_register_style('PRGLOGINCSS', plugins_url('assets/css/prg/login.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
510
+ wp_register_style('B2SDATEPICKERCSS', plugins_url('assets/lib/datepicker/css/bootstrap-datepicker3.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
511
+ wp_register_style('B2SAIRDATEPICKERCSS', plugins_url('assets/lib/air-datepicker/css/datepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
512
+ wp_register_style('B2STIMEPICKERCSS', plugins_url('assets/lib/timepicker/timepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
513
+ wp_register_style('PRGPOSTCSS', plugins_url('assets/css/prg/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
514
+ wp_register_style('B2SWYSIWYGCSS', plugins_url('assets/lib/wysiwyg/square.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
515
+ wp_register_style('B2SMETABOXCSS', plugins_url('assets/css/b2s/wp/post-meta-box.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
516
+ wp_register_style('B2SNOTICECSS', plugins_url('assets/css/notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
517
+
518
+ wp_register_script('B2SNETWORKJS', plugins_url('assets/js/b2s/network.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
519
+ wp_register_script('B2SSETTINGSJS', plugins_url('assets/js/b2s/settings.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
520
+ wp_register_script('B2SSTARTJS', plugins_url('assets/js/b2s/start.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
521
+ wp_register_script('B2SPOSTJS', plugins_url('assets/js/b2s/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
522
+ wp_register_script('B2SSHIPJS', plugins_url('assets/js/b2s/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
523
+ wp_register_script('PRGSHIPJS', plugins_url('assets/js/prg/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
524
+ wp_register_script('PRGLOGINJS', plugins_url('assets/js/prg/login.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
525
+ wp_register_script('B2SBOOTJS', plugins_url('assets/js/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
526
+ wp_register_script('B2SVALIDATEJS', plugins_url('assets/js/validate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
527
+ wp_register_script('B2SGENERALJS', plugins_url('assets/js/b2s/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
528
+ wp_register_script('B2SDATEPICKERJS', plugins_url('assets/lib/datepicker/js/bootstrap-datepicker.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
529
+ wp_register_script('B2SDATEPICKERDEJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.de_DE.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
530
+ wp_register_script('B2SDATEPICKERENJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.en_US.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
531
+ wp_register_script('B2SAIRDATEPICKERJS', plugins_url('assets/lib/air-datepicker/js/datepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
532
+ wp_register_script('B2SAIRDATEPICKERDEJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
533
+ wp_register_script('B2SAIRDATEPICKERENJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
534
+ wp_register_script('B2STIMEPICKERJS', plugins_url('assets/lib/timepicker/timepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
535
+ wp_register_script('B2SNOTICEJS', plugins_url('assets/js/notice.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
536
+ wp_register_script('PRGPOSTJS', plugins_url('assets/js/prg/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
537
+ wp_register_script('PRGGENERALJS', plugins_url('assets/js/prg/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
538
+ wp_register_script('B2SWYSIWYGJS', plugins_url('assets/lib/wysiwyg/jquery.sceditor.xhtml.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
539
+ wp_register_script('B2SWYSIWYGLANGDEJS', plugins_url('assets/lib/wysiwyg/languages/de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
540
+ wp_register_script('B2SWYSIWYGLANGENJS', plugins_url('assets/lib/wysiwyg/languages/en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
541
+ wp_register_script('B2SMETABOXJS', plugins_url('assets/js/b2s/wp/post-meta-box.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
542
}
543
544
public function activatePlugin() {
includes/MetaBox.php CHANGED
@@ -45,7 +45,7 @@ class B2S_MetaBox {
45
<a id="b2s-meta-box-btn-custom-share" class="b2s-btn b2s-btn-success b2s-btn-sm b2s-center-block b2s-btn-margin-bottom-15" href="#">' . __('Customize & Schedule Social Media Posts', 'blog2social') . '</a>
46
<hr>
47
<input type="hidden" name="b2s-post-meta-box-version" id="b2s-post-meta-box-version" value="' . B2S_PLUGIN_USER_VERSION . '"/>
48
- <h3 class="b2s-meta-box-headline">' . __('Social Media Auto-Posting', 'blog2social') . '<span class="b2s-color-green">' . __('(NEW)', 'blog2social') . '</span> <a id="b2s-info-btn-meta-box-modal-auto-post" class="b2s-info-btn" href="#b2sInfoMetaBoxModalAutoPost">' . __('Info', 'blog2social') . '</a></h3>
49
' . $lastPost . '
50
<input id="b2s-post-meta-box-time-dropdown-publish" class="post-format" name="b2s-post-meta-box-time-dropdown" value="publish" type="checkbox" ' . $isChecked . '>
51
<label for="b2s-post-meta-box-time-dropdown-publish" class="post-format-icon">' . __('enable Auto-Posting', 'blog2social') . '</label>
@@ -62,10 +62,10 @@ class B2S_MetaBox {
62
<div class="b2s-meta-box-modal-dialog">
63
<div class="b2s-meta-box-modal-header">
64
<a href="#b2s-meta-box-close" class="b2s-meta-box-modal-btn-close" aria-hidden="true">×</a>
65
- <h4 class="b2s-meta-box-modal-title">' . __('Blog2Social: Social Media Auto-Posting', 'blog2social') . ' <span class="b2s-color-green">' . __('(NEW)', 'blog2social') . '</span></h4>
66
</div>
67
<div class="b2s-meta-box-modal-body">
68
- <p>' . __('Blog2Social automatically shares your blog post on your selected social media networks when your post is published. Your selection will be saved and run automatically until changed.', 'blog2social');
69
if (B2S_PLUGIN_USER_VERSION == 0) {
70
$content .= '<hr>
71
<h4 class="b2s-meta-box-modal-h4">' . __('You want to auto-post your blog post?', 'blog2social') . '</h4>
@@ -121,7 +121,7 @@ class B2S_MetaBox {
121
122
$content .='<label>' . __('Schedule your post:', 'blog2social') . '</label>';
123
$content .= '<div class="b2s-post-meta-box-sched-area">';
124
-
125
$content .='<select class="b2s-post-meta-box-sched-select" style="width:100%;" name="b2s-post-meta-box-sched-select">
126
<option value="0">' . __('Share Now', 'blog2social') . '</option>
127
<option value="1">' . __('Schedule post once', 'blog2social') . '</option>
@@ -139,6 +139,7 @@ class B2S_MetaBox {
139
$content .="<input id='b2s-post-meta-box-best-time-settings' class='post-format' name='b2s-post-meta-box-best-time-settings' value='" . serialize($bestTimeSettings) . "' type='checkbox'> ";
140
$content .="<label class='post-format-icon' for='b2s-post-meta-box-best-time-settings'>" . __('allow for', 'blog2social');
141
$content .=' <a href="' . $this->b2sSiteUrl . 'wp-admin/admin.php?page=blog2social-settings' . '" target="_blank">' . __('My Time Settings', 'blog2social') . '</a></label>';
142
}
143
$content .="</div>";
144
45
<a id="b2s-meta-box-btn-custom-share" class="b2s-btn b2s-btn-success b2s-btn-sm b2s-center-block b2s-btn-margin-bottom-15" href="#">' . __('Customize & Schedule Social Media Posts', 'blog2social') . '</a>
46
<hr>
47
<input type="hidden" name="b2s-post-meta-box-version" id="b2s-post-meta-box-version" value="' . B2S_PLUGIN_USER_VERSION . '"/>
48
+ <h3 class="b2s-meta-box-headline">' . __('Social Media Auto-Posting', 'blog2social') . ' <a id="b2s-info-btn-meta-box-modal-auto-post" class="b2s-info-btn" href="#b2sInfoMetaBoxModalAutoPost">' . __('Info', 'blog2social') . '</a></h3>
49
' . $lastPost . '
50
<input id="b2s-post-meta-box-time-dropdown-publish" class="post-format" name="b2s-post-meta-box-time-dropdown" value="publish" type="checkbox" ' . $isChecked . '>
51
<label for="b2s-post-meta-box-time-dropdown-publish" class="post-format-icon">' . __('enable Auto-Posting', 'blog2social') . '</label>
62
<div class="b2s-meta-box-modal-dialog">
63
<div class="b2s-meta-box-modal-header">
64
<a href="#b2s-meta-box-close" class="b2s-meta-box-modal-btn-close" aria-hidden="true">×</a>
65
+ <h4 class="b2s-meta-box-modal-title">' . __('Blog2Social: Social Media Auto-Posting', 'blog2social') . '</h4>
66
</div>
67
<div class="b2s-meta-box-modal-body">
68
+ <p>' . __('The Blog2Social Auto-Posting feature will be activated by default. So your post will be shared automatically on your selected social media networks when your post is published. You can still deselect the checkbox manually when publishing/updating a post, if you do not need the feature in certain cases.', 'blog2social');
69
if (B2S_PLUGIN_USER_VERSION == 0) {
70
$content .= '<hr>
71
<h4 class="b2s-meta-box-modal-h4">' . __('You want to auto-post your blog post?', 'blog2social') . '</h4>
121
122
$content .='<label>' . __('Schedule your post:', 'blog2social') . '</label>';
123
$content .= '<div class="b2s-post-meta-box-sched-area">';
124
+ $content .='<span id="b2s-post-meta-box-info-share-now">' . __('If your Wordpress Post was scheduled on a certain date, Blog2Social will automatically post on this date too.', 'blog2social') . '</span>';
125
$content .='<select class="b2s-post-meta-box-sched-select" style="width:100%;" name="b2s-post-meta-box-sched-select">
126
<option value="0">' . __('Share Now', 'blog2social') . '</option>
127
<option value="1">' . __('Schedule post once', 'blog2social') . '</option>
139
$content .="<input id='b2s-post-meta-box-best-time-settings' class='post-format' name='b2s-post-meta-box-best-time-settings' value='" . serialize($bestTimeSettings) . "' type='checkbox'> ";
140
$content .="<label class='post-format-icon' for='b2s-post-meta-box-best-time-settings'>" . __('allow for', 'blog2social');
141
$content .=' <a href="' . $this->b2sSiteUrl . 'wp-admin/admin.php?page=blog2social-settings' . '" target="_blank">' . __('My Time Settings', 'blog2social') . '</a></label>';
142
+ $content .='<br><hr><span>' . __('Note: If you do not specify your own times, we automatically provide you with the best times to publish on the social networks. You can always enter your own times in the settings.', 'blog2social') . '</span>';
143
}
144
$content .="</div>";
145
includes/PRG/Api/Get.php CHANGED
@@ -12,6 +12,7 @@ class PRG_Api_Get {
12
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
13
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
14
curl_setopt($ch, CURLOPT_URL, $url);
15
$result = curl_exec($ch);
16
return $result;
17
}
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
}
includes/PRG/Api/Post.php CHANGED
@@ -12,6 +12,7 @@ class PRG_Api_Post {
12
curl_setopt($ch, CURLOPT_POST, true);
13
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
14
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
15
$result = curl_exec($ch);
16
return $result;
17
}
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
}
includes/PRG/Ship/Image.php CHANGED
@@ -2,19 +2,13 @@
2
3
class PRG_Ship_Image {
4
5
- public $isImage;
6
-
7
public function __construct() {
8
-
9
- }
10
-
11
- private function getAllImageData($id) {
12
- return B2S_Util::getImagesByPostID($id, true);
13
}
14
15
- public function getItemHtml($id) {
16
$content = '';
17
- $imageData = $this->getAllImageData($id);
18
$isImage = (is_array($imageData) && !empty($imageData)) ? true : false;
19
20
if ($isImage) {
2
3
class PRG_Ship_Image {
4
5
public function __construct() {
6
+
7
}
8
9
+ public function getItemHtml($postId,$postContent,$postUrl) {
10
$content = '';
11
+ $imageData = B2S_Util::getImagesByPostID($postId,$postContent,$postUrl, true);
12
$isImage = (is_array($imageData) && !empty($imageData)) ? true : false;
13
14
if ($isImage) {
includes/PRG/Ship/Item.php CHANGED
@@ -2,17 +2,10 @@
2
3
class PRG_Ship_Item {
4
5
- private $postData;
6
private $userData;
7
- private $postUrl;
8
9
- public function __construct($postId) {
10
- $this->postData = get_post($postId);
11
- $this->postUrl = (get_permalink($this->postData->ID) !== false ? get_permalink($this->postData->ID) : $this->postData->guid);
12
- }
13
-
14
- public function getPostData() {
15
- return $this->postData;
16
}
17
18
public function getMandant() {
2
3
class PRG_Ship_Item {
4
5
private $userData;
6
7
+ public function __construct() {
8
+
9
}
10
11
public function getMandant() {
includes/Util.php CHANGED
@@ -111,6 +111,7 @@ class B2S_Util {
111
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
112
do {
113
curl_setopt($rch, CURLOPT_URL, $newurl);
114
$header = curl_exec($rch);
115
if (curl_errno($rch)) {
116
$code = 0;
@@ -141,6 +142,7 @@ class B2S_Util {
141
curl_setopt($ch, CURLOPT_URL, $newurl);
142
}
143
}
144
return curl_exec($ch);
145
}
146
@@ -180,13 +182,14 @@ class B2S_Util {
180
return $list;
181
}
182
183
- public static function getImagesByPostId($postId = 0, $network = false) {
184
- $homeUrl = get_site_url(); //parse_url(get_site_url(), PHP_URL_HOST);
185
$scheme = parse_url($homeUrl, PHP_URL_SCHEME);
186
$featuredImage = wp_get_attachment_url(get_post_thumbnail_id($postId));
187
- $page_data = get_page($postId);
188
$matches = array();
189
- if (!preg_match_all('%<img.*?src="(.*?)".*?>%', $page_data->post_content, $matches) && !$featuredImage) {
190
return false;
191
}
192
array_unshift($matches[1], $featuredImage);
@@ -227,15 +230,18 @@ class B2S_Util {
227
return $rtrnArray;
228
}
229
230
- public static function prepareContent($content = '', $allowHtml = '<p><h1><h2><br><i><b><a><img>') {
231
- $homeUrl = get_site_url(); //parse_url(get_site_url(), PHP_URL_HOST);
232
$scheme = parse_url($homeUrl, PHP_URL_SCHEME);
233
- $content = html_entity_decode($content, ENT_COMPAT, 'UTF-8');
234
- $prepareContent = (empty($allowHtml)) ? self::cleanContent(strip_shortcodes($content)) : self::cleanContent(self::cleanHtmlAttr(strip_shortcodes(self::cleanShortCodeByCaption($content))));
235
$prepareContent = preg_replace('/(?:[ \t]*(?:\n|\r\n?)){3,}/', "\n\n", $prepareContent);
236
- if ($allowHtml != false) {
237
$tempContent = nl2br(trim(strip_tags($prepareContent, $allowHtml)));
238
- if (preg_match_all('%<img.*?src="(.*?)".*?/>%', $tempContent, $matches)) {
239
foreach ($matches[1] as $key => $imgUrl) {
240
if ($imgUrl == false) {
241
continue;
@@ -263,20 +269,60 @@ class B2S_Util {
263
return trim(strip_tags($prepareContent));
264
}
265
266
- public static function cleanHtmlAttr($content) {
267
- $content = preg_replace('/(<[^>]+) style=[\"\'].*?[\"\']/i', '$1', $content);
268
- $content = preg_replace('/(<[^>]+) class=[\"\'].*?[\"\']/i', '$1', $content);
269
- $content = preg_replace('/(<[^>]+) height=[\"\'].*?[\"\']/i', '$1', $content);
270
- $content = preg_replace('/(<[^>]+) width=[\"\'].*?[\"\']/i', '$1', $content);
271
- return preg_replace('/(<[^>]+) id=[\"\'].*?[\"\']/i', '$1', $content);
272
}
273
274
- public static function cleanContent($content) {
275
- return preg_replace('/\[.*?(?=\])\]/s', '', $content);
276
}
277
278
- public static function cleanShortCodeByCaption($content) {
279
- preg_match_all('#\s*\[caption[^]]*\].*?\[/caption\]\s*#is', $content, $matches);
280
if (isset($matches[0]) && !empty($matches[0]) && is_array($matches[0])) {
281
$temp = '';
282
foreach ($matches[0] as $k => $v) {
@@ -285,11 +331,11 @@ class B2S_Util {
285
$v = (isset($match[0])) ? str_replace($match[0], $match[0] . "\n\n", $v) : $v;
286
$t = preg_replace('#\s*\[/caption\]\s*#is', "\n\n", $v);
287
$new = preg_replace('#\s*\[caption[^]]*\]\s*#is', '', $t);
288
- $content = str_replace($temp, "\n" . $new, $content);
289
}
290
}
291
}
292
- return $content;
293
}
294
295
public static function getRandomTime($start, $ende) {
111
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
112
do {
113
curl_setopt($rch, CURLOPT_URL, $newurl);
114
+ curl_setopt($rch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0');
115
$header = curl_exec($rch);
116
if (curl_errno($rch)) {
117
$code = 0;
142
curl_setopt($ch, CURLOPT_URL, $newurl);
143
}
144
}
145
+ curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0');
146
return curl_exec($ch);
147
}
148
182
return $list;
183
}
184
185
+ public static function getImagesByPostId($postId = 0, $postContent = '', $postUrl = '', $network = false) {
186
+ $homeUrl = get_site_url();
187
$scheme = parse_url($homeUrl, PHP_URL_SCHEME);
188
$featuredImage = wp_get_attachment_url(get_post_thumbnail_id($postId));
189
+ $content = self::getFullContent($postId, $postContent, $postUrl);
190
+
191
$matches = array();
192
+ if (!preg_match_all('%<img.*?src=[\"\'](.*?)[\"\'].*?>%', $content, $matches) && !$featuredImage) {
193
return false;
194
}
195
array_unshift($matches[1], $featuredImage);
230
return $rtrnArray;
231
}
232
233
+ public static function prepareContent($postId = 0, $postContent = '', $postUrl = '', $allowHtml = '<p><h1><h2><br><i><b><a><img>', $allowEmoji = true) {
234
+ $homeUrl = get_site_url();
235
$scheme = parse_url($homeUrl, PHP_URL_SCHEME);
236
+ $postContent = html_entity_decode($postContent, ENT_COMPAT, 'UTF-8');
237
+ $postContent = self::getFullContent($postId, $postContent, $postUrl);
238
+ $prepareContent = ($allowHtml !== false) ? self::cleanContent(self::cleanHtmlAttr(strip_shortcodes(self::cleanShortCodeByCaption($postContent)))) : self::cleanContent(strip_shortcodes($postContent));
239
+ $prepareContent = ($allowEmoji !== false) ? $prepareContent : self::remove4byte($prepareContent);
240
$prepareContent = preg_replace('/(?:[ \t]*(?:\n|\r\n?)){3,}/', "\n\n", $prepareContent);
241
+
242
+ if ($allowHtml !== false) {
243
$tempContent = nl2br(trim(strip_tags($prepareContent, $allowHtml)));
244
+ if (preg_match_all('%<img.*?src=[\"\'](.*?)[\"\'].*?/>%', $tempContent, $matches)) {
245
foreach ($matches[1] as $key => $imgUrl) {
246
if ($imgUrl == false) {
247
continue;
269
return trim(strip_tags($prepareContent));
270
}
271
272
+ public static function cleanHtmlAttr($postContent) {
273
+ $postContent = preg_replace('/(<[^>]+) style=[\"\'].*?[\"\']/i', '$1', $postContent);
274
+ $postContent = preg_replace('/(<[^>]+) class=[\"\'].*?[\"\']/i', '$1', $postContent);
275
+ $postContent = preg_replace('/(<[^>]+) height=[\"\'].*?[\"\']/i', '$1', $postContent);
276
+ $postContent = preg_replace('/(<[^>]+) width=[\"\'].*?[\"\']/i', '$1', $postContent);
277
+ return preg_replace('/(<[^>]+) id=[\"\'].*?[\"\']/i', '$1', $postContent);
278
+ }
279
+
280
+ public static function cleanContent($postContent) {
281
+ return preg_replace('/\[.*?(?=\])\]/s', '', $postContent);
282
+ }
283
+
284
+ public static function getFullContent($postId = 0, $postContent = '', $postUrl = '') {
285
+ //isset settings allow shortcode
286
+ if (get_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID) !== false) {
287
+ //check is shortcode in content
288
+ if (preg_match('/\[(.*?)\]/s', $postContent)) {
289
+ //check has crawled content from frontend
290
+ $dbContent = get_option('B2S_PLUGIN_POST_CONTENT_' . $postId);
291
+ if ($dbContent !== false) {
292
+ return $dbContent;
293
+ } else {
294
+ //crawl content from frontend
295
+ $postUrl = add_query_arg('b2s_get_full_content', 1, $postUrl);
296
+ $wpB2sGetFullContent = wp_remote_get($postUrl, array('timeout' => 11)); //slot 11 seconds
297
+ if (is_array($wpB2sGetFullContent) && !is_wp_error($wpB2sGetFullContent)) {
298
+ //get crwaled content from db - hide cache by get_options
299
+ global $wpdb;
300
+ $dbContent = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM " . $wpdb->options . " WHERE option_name =%s ", 'B2S_PLUGIN_POST_CONTENT_' . $postId));
301
+ if ($dbContent !== NULL) {
302
+ return $dbContent;
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ return $postContent;
309
}
310
311
+ //Emoji by Schedule + AllowNoNetwork
312
+ public static function remove4byte($content) {
313
+ if (function_exists('iconv')) {
314
+ $content = iconv("utf-8", "utf-8//ignore", $content);
315
+ }
316
+ return trim(preg_replace('%(?:
317
+ \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
318
+ | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
319
+ | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
320
+ | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
321
+ )%xs','', $content));
322
}
323
324
+ public static function cleanShortCodeByCaption($postContent) {
325
+ preg_match_all('#\s*\[caption[^]]*\].*?\[/caption\]\s*#is', $postContent, $matches);
326
if (isset($matches[0]) && !empty($matches[0]) && is_array($matches[0])) {
327
$temp = '';
328
foreach ($matches[0] as $k => $v) {
331
$v = (isset($match[0])) ? str_replace($match[0], $match[0] . "\n\n", $v) : $v;
332
$t = preg_replace('#\s*\[/caption\]\s*#is', "\n\n", $v);
333
$new = preg_replace('#\s*\[caption[^]]*\]\s*#is', '', $t);
334
+ $postContent = str_replace($temp, "\n" . $new, $postContent);
335
}
336
}
337
}
338
+ return $postContent;
339
}
340
341
public static function getRandomTime($start, $ende) {
index.php CHANGED
@@ -1,19 +1,19 @@
1
<?php
2
3
/*
4
- * Plugin Name:Blog2Social: Social Media Schedule&Auto-Post
5
* Plugin URI: http://www.blog2social.com
6
- * Description:Auto-post, crosspost, schedule & share blogposts to profiles, pages and groups on social media: Facebook, Twitter, LinkedIn, Instagram, Pinterest etc.
7
* Author: Blog2Social, Adenion
8
* Text Domain: blog2social
9
* Domain Path: /languages
10
- * Version: 3.1.3
11
* Author URI: http://www.blog2social.com
12
* License: GPL2+
13
*/
14
15
//B2SDefine
16
- define('B2S_PLUGIN_VERSION', '313');
17
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
18
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
19
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
@@ -24,6 +24,26 @@ $language = (!in_array(get_locale(), unserialize(B2S_PLUGIN_LANGUAGE))) ? 'en_US
24
define('B2S_LANGUAGE', $language);
25
define('B2S_PLUGIN_BASENAME', plugin_basename(__FILE__));
26
27
//B2SLoad
28
require_once(B2S_PLUGIN_DIR . 'includes/Init.php');
29
$b2sInit = new B2S_Init();
1
<?php
2
3
/*
4
+ * Plugin Name:Social Media Auto Post & Scheduler
5
* Plugin URI: http://www.blog2social.com
6
+ * Description:Auto publish, schedule & share posts on social media: Facebook, Twitter, Google+, XING, LinkedIn, Instagram, ... crosspost to pages & groups
7
* Author: Blog2Social, Adenion
8
* Text Domain: blog2social
9
* Domain Path: /languages
10
+ * Version: 3.7.1
11
* Author URI: http://www.blog2social.com
12
* License: GPL2+
13
*/
14
15
//B2SDefine
16
+ define('B2S_PLUGIN_VERSION', '370');
17
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
18
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
19
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
24
define('B2S_LANGUAGE', $language);
25
define('B2S_PLUGIN_BASENAME', plugin_basename(__FILE__));
26
27
+ //B2SNoCaching
28
+ if (!defined('DONOTCACHEPAGE')) {
29
+ define('DONOTCACHEPAGE', true);
30
+ }
31
+ if (!defined('DONOTCACHEDB')) {
32
+ define('DONOTCACHEDB', true);
33
+ }
34
+ if (!defined('DONOTMINIFY')) {
35
+ define('DONOTMINIFY', true);
36
+ }
37
+ if (!defined('DONOTCDN')) {
38
+ define('DONOTCDN', true);
39
+ }
40
+ if (!defined('DONOTCACHCEOBJECT')) {
41
+ define('DONOTCACHCEOBJECT', true);
42
+ }
43
+ if (function_exists("nocache_headers")) {
44
+ nocache_headers(); //wp-functions
45
+ }
46
+
47
//B2SLoad
48
require_once(B2S_PLUGIN_DIR . 'includes/Init.php');
49
$b2sInit = new B2S_Init();
languages/blog2social-de_DE.mo CHANGED
Binary file
languages/blog2social-de_DE.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: Blog2Social V3 - Development Modus\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: Wed Aug 03 2016 11:16:25 GMT+0200\n"
6
- "PO-Revision-Date: Mon Jan 30 2017 09:15:57 GMT+0100\n"
7
"Last-Translator: admin <s.buerger@adenion.de>\n"
8
"Language-Team: \n"
9
"Language: German\n"
@@ -22,11 +22,29 @@ msgstr ""
22
"X-Loco-Target-Locale: de_DE\n"
23
"X-Generator: Loco - https://localise.biz/"
24
25
- #: ../includes/B2S/Settings/Item.php:110
26
msgid "Uhr"
27
msgstr ""
28
29
- #: ../includes/Ajax/Get.php:200
30
msgid "ERROR 404 - Page not found"
31
msgstr "FEHLER 404 - Seite nicht gefunden"
32
@@ -43,14 +61,14 @@ msgid "get more"
43
msgstr "mehr"
44
45
#: ../includes/B2S/Network/Item.php:84 ../includes/B2S/Network/Item.php:98 ..
46
- #: /includes/B2S/Settings/Item.php:96 ../includes/B2S/Ship/Portale.php:35 ..
47
- #: /includes/Init.php:236
48
msgid "Profile"
49
msgstr "Profil"
50
51
#: ../includes/B2S/Network/Item.php:87 ../includes/B2S/Network/Item.php:87 ..
52
- #: /includes/B2S/Network/Item.php:108 ../includes/B2S/Settings/Item.php:99 ..
53
- #: /includes/B2S/Ship/Portale.php:33 ../includes/Init.php:236
54
msgid "Page"
55
msgstr "Seite"
56
@@ -59,8 +77,8 @@ msgid "You want to connect a network page?"
59
msgstr "Du möchtest eine Netzwerk-Seite verbinden?"
60
61
#: ../includes/B2S/Network/Item.php:90 ../includes/B2S/Network/Item.php:90 ..
62
- #: /includes/B2S/Network/Item.php:118 ../includes/B2S/Settings/Item.php:103 ..
63
- #: /includes/B2S/Ship/Portale.php:29 ../includes/Init.php:236
64
msgid "Group"
65
msgstr "Gruppe"
66
@@ -69,7 +87,7 @@ msgid "You want to connect a social media group?"
69
msgstr "Du möchtest eine Social-Media-Gruppe verbinden?"
70
71
#: ../includes/B2S/Network/Item.php:99 ../includes/B2S/Network/Item.php:109 ..
72
- #: /includes/B2S/Network/Item.php:119 ../includes/B2S/Ship/Item.php:438 ..
73
#: /views/b2s/network.php:152
74
msgid "delete"
75
msgstr "löschen"
@@ -88,69 +106,69 @@ msgstr "Deine Autorisierung ist abgelaufen"
88
msgid "all authors"
89
msgstr "alle Autoren"
90
91
- #: ../includes/B2S/Post/Filter.php:45 ../includes/B2S/Post/Item.php:177 ..
92
- #: /includes/B2S/Ship/Save.php:176 ../includes/PRG/Post/Filter.php:40 ..
93
- #: /includes/PRG/Post/Item.php:78 ../views/b2s/ship.php:8
94
msgid "published"
95
msgstr "veröffentlicht"
96
97
- #: ../includes/B2S/Post/Filter.php:45 ../includes/B2S/Post/Item.php:177 ..
98
#: /includes/PRG/Post/Filter.php:40 ../includes/PRG/Post/Item.php:78 ..
99
- #: /views/b2s/ship.php:8
100
msgid "scheduled"
101
msgstr "geplant"
102
103
- #: ../includes/B2S/Post/Filter.php:45 ../includes/B2S/Post/Item.php:177 ..
104
#: /includes/PRG/Post/Filter.php:40 ../includes/PRG/Post/Item.php:78 ..
105
- #: /views/b2s/ship.php:8
106
msgid "draft"
107
msgstr "Entwurf"
108
109
- #: ../includes/B2S/Post/Filter.php:46
110
msgid "all statuses"
111
msgstr "kein Status"
112
113
- #: ../includes/B2S/Post/Filter.php:57 ../includes/B2S/Post/Filter.php:69
114
msgid "newest first"
115
msgstr "neuste zuerst"
116
117
- #: ../includes/B2S/Post/Filter.php:57 ../includes/B2S/Post/Filter.php:69
118
msgid "oldest first"
119
msgstr "älteste zuerst"
120
121
- #: ../includes/B2S/Post/Filter.php:82
122
msgid "all categories & tags"
123
msgstr "alle Kategorien & Schlagwörter"
124
125
- #: ../includes/B2S/Post/Filter.php:100
126
msgid "all post types"
127
msgstr "alle Typen"
128
129
- #: ../includes/B2S/Post/Filter.php:118 ../includes/PRG/Post/Filter.php:54
130
msgid "Search Title"
131
msgstr "Suche nach Titel"
132
133
- #: ../includes/B2S/Post/Filter.php:138
134
msgid "hide calendar"
135
msgstr "Planungskalender verbergen"
136
137
- #: ../includes/B2S/Post/Filter.php:138 ../includes/B2S/Post/Filter.php:138
138
msgid "show calendar"
139
msgstr "Planungskalender anzeigen"
140
141
- #: ../includes/B2S/Post/Filter.php:141 ../includes/PRG/Post/Filter.php:64
142
msgid "sort"
143
msgstr "sortieren"
144
145
- #: ../includes/B2S/Post/Filter.php:142 ../includes/PRG/Post/Filter.php:65
146
msgid "reset"
147
msgstr "zurücksetzen"
148
149
- #: ../includes/B2S/Post/Filter.php:147
150
msgid "selected date"
151
msgstr "ausgewähltes Datum"
152
153
- #: ../includes/B2S/Post/Filter.php:147
154
msgid "scheduled post(s)"
155
msgstr "geplante Beiträge"
156
@@ -158,93 +176,96 @@ msgstr "geplante Beiträge"
158
msgid "You have no posts published or scheduled."
159
msgstr "Du hast keine Beiträge veröffentlicht oder geplant."
160
161
- #: ../includes/B2S/Post/Item.php:196
162
msgid "last shared on social media"
163
msgstr "zuletzt auf Social Media geteilt"
164
165
- #: ../includes/B2S/Post/Item.php:203 ../includes/Init.php:71
166
msgid "Share on Social Media"
167
msgstr "auf Social Media teilen"
168
169
- #: ../includes/B2S/Post/Item.php:205 ../includes/PRG/Post/Item.php:104
170
msgid "Author"
171
msgstr "Autor"
172
173
- #: ../includes/B2S/Post/Item.php:205 ../views/b2s/ship.php:21
174
msgid "on blog"
175
msgstr "auf dem Blog"
176
177
- #: ../includes/B2S/Post/Item.php:222 ../views/b2s/ship.php:205 ../views/b2s/ship.
178
- #: php:207
179
msgid "Re-share this post"
180
msgstr "Diesen Beitrag nochmal teilen"
181
182
- #: ../includes/B2S/Post/Item.php:223 ../includes/B2S/Post/Item.php:246
183
msgid "Details"
184
msgstr "Details"
185
186
- #: ../includes/B2S/Post/Item.php:225
187
msgid "shared social media posts"
188
msgstr "geteilte Beiträge"
189
190
- #: ../includes/B2S/Post/Item.php:225
191
msgid "latest share by"
192
msgstr "zuletzt geteilt von"
193
194
- #: ../includes/B2S/Post/Item.php:248
195
msgid "scheduled social media posts"
196
msgstr "geplante Beiträge"
197
198
- #: ../includes/B2S/Post/Item.php:248
199
msgid "next share by"
200
msgstr "als nächstes geteilt von"
201
202
- #: ../includes/B2S/Post/Item.php:353 ../includes/B2S/Post/Item.php:406
203
msgid "select all"
204
msgstr "alle auswählen"
205
206
- #: ../includes/B2S/Post/Item.php:355 ../includes/B2S/Post/Item.php:408 ..
207
- #: /views/b2s/dashboard.php:118
208
msgid "Auto-Posting"
209
msgstr "Auto-Posting"
210
211
- #: ../includes/B2S/Post/Item.php:356
212
msgid "show"
213
msgstr "ansehen"
214
215
- #: ../includes/B2S/Post/Item.php:371
216
msgid "shared by"
217
msgstr "geteilt von"
218
219
- #: ../includes/B2S/Post/Item.php:374 ../includes/B2S/Post/Item.php:386
220
msgid "You want to delete a publish post entry?"
221
msgstr "Du möchtest einen veröffentlichten Beitrag löschen?"
222
223
- #: ../includes/B2S/Post/Item.php:375 ../includes/B2S/Post/Item.php:387
224
msgid "delete from reporting"
225
msgstr "aus Reporting löschen"
226
227
- #: ../includes/B2S/Post/Item.php:377
228
msgid "re-share"
229
msgstr "erneut teilen"
230
231
- #: ../includes/B2S/Post/Item.php:417
232
msgid "scheduled by"
233
msgstr "geplant von "
234
235
- #: ../includes/B2S/Post/Item.php:420 ../includes/B2S/Post/Item.php:434
236
msgid "You want to delete an scheduled post entry?"
237
msgstr "Du möchtest einen geplanten Beitrag löschen?"
238
239
- #: ../includes/B2S/Post/Item.php:421 ../includes/B2S/Post/Item.php:435
240
msgid "delete scheduling"
241
msgstr "Planung löschen"
242
243
- #: ../includes/B2S/Post/Item.php:425
244
msgid "You want to change the time for your scheduled post?"
245
msgstr "Du möchtest die Zeit zu einem geplanten Beitrag ändern?"
246
247
- #: ../includes/B2S/Post/Item.php:426
248
msgid "change time"
249
msgstr "Zeitpunkt ändern"
250
@@ -253,50 +274,55 @@ msgid "use b2s.pm Link Shortner"
253
msgstr "b2s.pm Link Shortner aktivieren"
254
255
#: ../includes/B2S/Settings/Item.php:58
256
- msgid "save as default Auto-Posting"
257
msgstr "Auto-Posting standardmäßig aktivieren"
258
259
- #: ../includes/B2S/Settings/Item.php:64 ../views/b2s/settings.php:72
260
- msgid "Facebook - Specify the publication format"
261
- msgstr "Facebook Format der Veröffentlichung festlegen"
262
263
- #: ../includes/B2S/Settings/Item.php:67 ../views/b2s/settings.php:77
264
- msgid "Share with a focus on the link"
265
- msgstr "Teile Deinen Beitrag mit dem Fokus auf den Link"
266
267
- #: ../includes/B2S/Settings/Item.php:72 ../views/b2s/settings.php:80
268
- msgid "Share with a focus on the image"
269
- msgstr "Teile Deinen Beitrag mit dem Fokus auf das Bild"
270
271
- #: ../includes/B2S/Settings/Item.php:114
272
msgid "Best times to post"
273
msgstr "Beste Zeiten"
274
275
- #: ../includes/B2S/Settings/Item.php:127 ../views/b2s/settings.php:41 ..
276
- #: /views/b2s/ship.php:42 ../views/b2s/html/footer.phtml:72
277
msgid "You want to schedule your posts and use the Best Time Scheduler?"
278
msgstr ""
279
"Du möchtest die Veröffentlichung Deiner Posts planen und den Beste Zeiten "
280
"Manager benutzen?"
281
282
- #: ../includes/B2S/Settings/Item.php:129 ../views/b2s/post.sched.php:81
283
msgid "save"
284
msgstr "speichern"
285
286
- #: ../includes/B2S/Settings/Item.php:134
287
msgid "Sorry, we can not load your data at the moment..."
288
msgstr "Sorry, derzeit können wir Deine Daten nicht laden. Versuche es erneut."
289
290
- #: ../includes/B2S/Ship/Image.php:20 ../views/b2s/ship.php:253 ../views/prg/ship.
291
- #: php:30
292
msgid "Select Image"
293
msgstr "Bild auswählen"
294
295
- #: ../includes/B2S/Ship/Image.php:20
296
msgid "Post no image"
297
msgstr "kein Bild übertragen"
298
299
- #: ../includes/B2S/Ship/Image.php:21
300
msgid ""
301
"The best size for images in social media posts are between: 667-1000px x 523-"
302
"1000px <br>Blog2Social will automatically resize your image according to "
@@ -306,162 +332,169 @@ msgstr ""
306
"1000px x 523-1000px <br> Blog2Social passt Dein Bild automatisch die Größe "
307
"des jeweiligen Netzwerks an."
308
309
- #: ../includes/B2S/Ship/Image.php:22
310
msgid "On Pinterest, Flickr and Instagram may be published with a image."
311
msgstr ""
312
"Auf Pinterest, Flickr und Instagram können Beiträge nur mit einem Bild "
313
"veröffentlicht werden."
314
315
- #: ../includes/B2S/Ship/Image.php:41
316
- msgid "Images not found"
317
- msgstr "Keine Bilder zum Teilen gefunden"
318
-
319
- #: ../includes/B2S/Ship/Image.php:42
320
- msgid "Pinterest, Flickr and Instagram can only be shared with a image included"
321
msgstr ""
322
- "Auf den Netzwerken Pinterest, Flickr und Instagram kann nur mit einem Bild "
323
- "geteilt werden."
324
325
- #: ../includes/B2S/Ship/Item.php:69
326
msgid "Network does not support image for profiles"
327
msgstr "Netzwerk unterstützt keine Bilder für Profile"
328
329
- #: ../includes/B2S/Ship/Item.php:70
330
msgid "Network defines image by link"
331
msgstr "Netzwerk wählt selber das Bild aus"
332
333
- #: ../includes/B2S/Ship/Item.php:72
334
msgid "Supported HTML tags"
335
msgstr "Erlaubte HTML-Elemente"
336
337