Blog2Social: Social Media Auto Post & Scheduler - Version 4.9.1

Version Description

Usability Optimization, adapting to the facebook sharing process

Download this release

Release Info

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

Code changes from version 4.9.0 to 4.9.1

assets/css/b2s/calendar.css CHANGED
@@ -280,3 +280,7 @@ body .fc-day-grid-event .fc-content{
280
.b2s-calendar-filter-img{
281
width: 32px;
282
}
280
.b2s-calendar-filter-img{
281
width: 32px;
282
}
283
+
284
+ .b2s-post-approve-info{
285
+ display: none;
286
+ }
assets/css/b2s/post.approve.css ADDED
@@ -0,0 +1,299 @@
1
+ /*Custom*/
2
+ .b2s-sched-btn {
3
+ margin-top: 0px;
4
+ }
5
+ .media {
6
+ width: 100%;
7
+ }
8
+ .form-inline {
9
+ width: 100%;
10
+ margin-bottom: 20px;
11
+ }
12
+ .form-inline .form-group {
13
+ margin-left: 2px;
14
+ }
15
+ .media-head {
16
+ width: 100% !important;
17
+ }
18
+ @media(max-width: 549px) {
19
+ .b2s-post-btn {
20
+ width: 100%;
21
+ }
22
+ .form-inline button, .form-inline a {
23
+ width: 100%;
24
+ margin-bottom: 10px;
25
+ }
26
+ }
27
+ @media(max-width: 767px) {
28
+ .form-inline {
29
+ display: none;
30
+ }
31
+ .filterHide {
32
+ display: none;
33
+ }
34
+ .form-inline button ,.form-inline a {
35
+ width: 49%;
36
+ margin-bottom: 10px;
37
+ }
38
+ }
39
+
40
+ .checkbox-item{
41
+ margin: 25px 5px 0 !important;
42
+ }
43
+ .checkbox-all-label{
44
+ padding-left:25px !important;
45
+ }
46
+ .checkbox-all{
47
+ margin-top: 2px !important;
48
+ }
49
+
50
+
51
+ .checkbox-all-label-btn{
52
+ padding-left:25px !important;
53
+ margin-left: -20px;
54
+ position: absolute;
55
+ }
56
+ .checkbox-all-btn{
57
+ color: #444 !important;
58
+ }
59
+
60
+ .datepicker table tr td.event {
61
+ background-color: #ffdb99;
62
+ border-color: #ffb733;
63
+ color: #000;
64
+ }
65
+ .datepicker table tr td.today {
66
+ background-color: #fff !important;
67
+ border-color: #fff !important;
68
+ color: #000;
69
+ font-weight: 700;
70
+ font-size: 15px;
71
+ }
72
+ .datepicker table tr td.active {
73
+ background-color: #337ab7 !important;
74
+ border-color: #2e6da4 !important;
75
+ color: #fff;
76
+ }
77
+ .datepicker-inline{
78
+ width: 100% !important;
79
+ }
80
+ .table-condensed{
81
+ width: 100%;
82
+ }
83
+ #b2s-sched-datepicker-area{
84
+ background-color: #fff;
85
+ border: 1px solid #ddd;
86
+ border-radius: 4px;
87
+ padding: 10px 15px;
88
+ margin-top: 10px;
89
+ }
90
+ .datepicker-switch, .prev, .next{
91
+ background: #eee no-repeat;
92
+ border-radius: 0px !important;
93
+ }
94
+ .prev, .next{
95
+ font-size: 24px;
96
+ }
97
+
98
+ .b2s-calendar-legend-active{
99
+ color: #337ab7 ;
100
+ border-color: #2e6da4;
101
+ border-radius: 4px;
102
+ }
103
+ .b2s-calendar-legend-event{
104
+ color: #ffdb99;
105
+ border-color: #ffb733;
106
+ border-radius: 4px;
107
+ }
108
+ .b2s-loading-area{
109
+ width: 100% !important;
110
+ }
111
+ .checbox-item-empty{
112
+ padding: 15px;
113
+ float:left;
114
+ }
115
+
116
+
117
+
118
+ /**edit post **/
119
+ .network-name{
120
+ font-weight: bold;
121
+ }
122
+ .network-profile{
123
+ margin-bottom: 5px;
124
+ }
125
+ .b2s-post-item-thumb {
126
+ width: 5%;
127
+ margin-right: 8px;
128
+ }
129
+
130
+ .b2s-post-item-thumb img {
131
+ border-radius: 50%;
132
+ width: 48px;
133
+ }
134
+
135
+ .b2s-post-item-details {
136
+ width: 93%;
137
+ }
138
+
139
+ .b2s-post-item-details, .b2s-post-item-thumb {
140
+ float: left;
141
+ }
142
+ .b2s-post-item-details h4 {
143
+ font-size: 16px;
144
+ font-weight: 600;
145
+ text-transform: uppercase;
146
+ margin: 3px 3px 3px 0px;
147
+ }
148
+ .btn-circle {
149
+ width: 30px;
150
+ height: 30px;
151
+ text-align: center;
152
+ padding: 6px 0;
153
+ font-size: 12px;
154
+ line-height: 1.428571429;
155
+ border-radius: 15px;
156
+ }
157
+ .fb-url-image, .xing-url-image, .linkedin-url-image, .tw-url-image, .b2s-image-border {
158
+ margin-right: 10px;
159
+ margin-bottom: 20px;
160
+ border: 1px dashed #bdbfc2;
161
+ box-shadow: none;
162
+ padding: 5px;
163
+ }
164
+ textarea.form-control {
165
+ height: auto;
166
+ }
167
+ .fb-textarea-input, .tw-textarea-input, .xing-textarea-input, .linkedin-textarea-input {
168
+ font-size: 14px;
169
+ font-weight: normal;
170
+ line-height: 1.125;
171
+ width: 100%;
172
+ border: medium none;
173
+ border-radius: 0;
174
+ margin-top: 10px;
175
+ margin-bottom: 10px;
176
+ font-family: helvetica,arial,sans-serif;
177
+ }
178
+ .b2s-post-item-details-item-message-input{
179
+ min-height: 100px;
180
+ }
181
+ .b2s-post-item-details-url-image{
182
+ cursor: pointer;
183
+ }
184
+ .b2s-user-network-settings-post-format-area label > input {
185
+ visibility: hidden;
186
+ position: absolute;
187
+ }
188
+ .b2s-settings-checked + img {
189
+ border: 3px solid #79b232 !important;
190
+ }
191
+ .b2s-image-item {
192
+ background-color: #fff;
193
+ border: 1px solid #ddd;
194
+ display: block;
195
+ float: left;
196
+ height: 200px;
197
+ line-height: 1.42857;
198
+ margin-bottom: 15px;
199
+ margin-left: 15px;
200
+ margin-top: 15px;
201
+ overflow: hidden;
202
+ padding: 4px;
203
+ transition: border 0.2s ease-in-out 0s;
204
+ width: 185px;
205
+ }
206
+ .b2s-image-item-thumb {
207
+ height: 150px;
208
+ }
209
+ .b2s-image-change-all-network,.b2s-upload-image-free-version,.b2s-image-change-this-network{
210
+ margin-right: 5px !important;
211
+ }
212
+ .b2s-image-remove-btn {
213
+ position: absolute;
214
+ top: -5px;
215
+ right: 0px;
216
+ font-weight: 700 !important;
217
+ }
218
+ .b2s-calendar-delete{
219
+ cursor: pointer;
220
+ }
221
+ .b2s-btn-label-premium{
222
+ color: #fff;
223
+ text-decoration: none !important;
224
+ cursor: default !important;
225
+ }
226
+ .b2s-btn-label-premium:hover{
227
+ color: #fff;
228
+ text-decoration: none !important;
229
+ cursor: default !important;
230
+ }
231
+ .b2s-post-item .label-success{
232
+ display: none;
233
+ }
234
+ .og_title, .og_desc, .card_desc, .card_title, .b2s-post-item-details-item-title-input, .b2s-select{
235
+ margin-bottom: 8px !important;
236
+ }
237
+
238
+ .b2s-post-item-info-area {
239
+ font-size: 11px !important;
240
+ }
241
+
242
+ .b2s-post-ship-item-full-text, .b2s-post-ship-item-message-delete, .b2s-post-ship-item-network-settings, .b2s-post-ship-item-post-format{
243
+ line-height: 1.5 !important;
244
+ padding: 0 1px 3px !important;
245
+ }
246
+
247
+ .b2s-load-info-meta-tag-modal{
248
+ margin-top: 8px !important;
249
+ display: block !important;
250
+ margin-right: auto !important;
251
+ margin-left: auto !important;
252
+ }
253
+
254
+ .b2s-post-item-details-tag-add-div {
255
+ border: 0px !important;
256
+ box-shadow: 0px 0px 0px #000 !important;
257
+ }
258
+
259
+ .b2s-post-item-details-tag-input-elem {
260
+ margin: 2px 4px;
261
+ max-width: 145px !important;
262
+ }
263
+ .b2s-calendar-sched-post-btn{
264
+ font-size: 11px;
265
+ float: right;
266
+ padding: 2px 4px 0px 4px;
267
+ }
268
+
269
+
270
+ .form-inline {
271
+ width: 100%;
272
+ margin-bottom: 20px;
273
+ }
274
+ .form-inline .form-group {
275
+ margin-left: 2px;
276
+ }
277
+
278
+ @media(max-width: 549px) {
279
+ .b2s-post-btn {
280
+ width: 100%;
281
+ }
282
+ .form-inline button, .form-inline a {
283
+ width: 100%;
284
+ margin-bottom: 10px;
285
+ }
286
+ }
287
+ @media(max-width: 767px) {
288
+ .form-inline {
289
+ display: none;
290
+ }
291
+ .filterHide {
292
+ display: none;
293
+ }
294
+ .form-inline button ,.form-inline a {
295
+ width: 49%;
296
+ margin-bottom: 10px;
297
+ }
298
+ }
299
+
assets/css/b2s/post.css CHANGED
@@ -33,4 +33,8 @@
33
34
.b2s-loading-area{
35
width: 100% !important;
36
}
33
34
.b2s-loading-area{
35
width: 100% !important;
36
+ }
37
+
38
+ .b2s-post-approve-info{
39
+ display: none;
40
}
assets/css/b2s/ship.css CHANGED
@@ -815,3 +815,11 @@ input[type="number"]{
815
.b2s-post-relay-area-select{
816
margin-bottom: 0px !important;
817
}
815
.b2s-post-relay-area-select{
816
margin-bottom: 0px !important;
817
}
818
+
819
+ .b2s-border-color-warning{
820
+ border-color: #204d74 !important;
821
+ }
822
+
823
+ .b2s-post-approve-info{
824
+ display: none;
825
+ }
assets/js/b2s/calendar.js CHANGED
@@ -56,6 +56,9 @@ jQuery(document).ready(function () {
56
'user_timezone': event.user_timezone,
57
'sched_date': event.start.format(),
58
'post_for_relay': event.post_for_relay,
59
},
60
success: function (data) {
61
refreshCalender();
@@ -148,13 +151,25 @@ function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_typ
148
jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
149
}
150
151
} else {
152
jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
153
jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
154
jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
155
- }
156
-
157
158
}
159
160
jQuery("#b2sPostId").val(post_id);
@@ -427,6 +442,7 @@ jQuery(document).on("click", ".b2s-edit-post-delete", function () {
427
var id = jQuery(this).data("b2s-id");
428
var post_id = jQuery(this).data("post-id");
429
var post_for_relay = jQuery(this).data("data-post-for-relay");
430
jQuery.ajax({
431
url: ajaxurl,
432
type: "POST",
@@ -436,7 +452,8 @@ jQuery(document).on("click", ".b2s-edit-post-delete", function () {
436
'action': 'b2s_delete_post',
437
'b2s_id': id,
438
'post_id': post_id,
439
- 'post_for_relay': post_for_relay
440
},
441
success: function (data) {
442
jQuery('#b2s-edit-event-modal-' + id).modal('hide');
56
'user_timezone': event.user_timezone,
57
'sched_date': event.start.format(),
58
'post_for_relay': event.post_for_relay,
59
+ 'post_for_approve': event.post_for_approve,
60
+ 'network_type': event.network_type,
61
+ 'nework_id': event.network_id
62
},
63
success: function (data) {
64
refreshCalender();
151
jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
152
}
153
154
+
155
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
156
+ if (network_id == 1 && network_type == 0) {
157
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
158
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
159
+ }
160
+
161
+
162
} else {
163
jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
164
jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
165
jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
166
167
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
168
+ if (network_id == 1 && network_type == 0) {
169
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
170
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
171
+ }
172
+ }
173
}
174
175
jQuery("#b2sPostId").val(post_id);
442
var id = jQuery(this).data("b2s-id");
443
var post_id = jQuery(this).data("post-id");
444
var post_for_relay = jQuery(this).data("data-post-for-relay");
445
+ var post_for_approve = jQuery(this).data("data-post-for-approve");
446
jQuery.ajax({
447
url: ajaxurl,
448
type: "POST",
452
'action': 'b2s_delete_post',
453
'b2s_id': id,
454
'post_id': post_id,
455
+ 'post_for_relay': post_for_relay,
456
+ 'post_for_approve': post_for_approve
457
},
458
success: function (data) {
459
jQuery('#b2s-edit-event-modal-' + id).modal('hide');
assets/js/b2s/post.js CHANGED
@@ -35,6 +35,12 @@ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (
35
jQuery('body').addClass('modal-open');
36
});
37
38
jQuery(document).on('click', '.b2sDetailsPublishPostBtn', function () {
39
var postId = jQuery(this).attr('data-post-id');
40
var showByDate = jQuery(this).attr('data-search-date');
@@ -74,6 +80,43 @@ jQuery(document).on('click', '.b2sDetailsPublishPostBtn', function () {
74
}
75
});
76
77
78
jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
79
jQuery('#b2sPagination').val("1");
@@ -239,6 +282,12 @@ jQuery(document).on('click', '.b2sDetailsPublishPostTriggerLink', function () {
239
jQuery(this).parent().prev().find('button').trigger('click');
240
return false;
241
});
242
jQuery(document).on('click', '.b2sDetailsSchedPostTriggerLink', function () {
243
if (jQuery('#b2s-redirect-url-sched-post').val() == undefined || jQuery('#b2s-redirect-url-sched-post').val() === null) {
244
//self page blog2social-sched
@@ -317,6 +366,7 @@ jQuery(document).on('click', '.b2s-sched-delete-confirm-btn', function () {
317
}
318
});
319
});
320
jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
321
var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
322
if (checkboxes.length > 0) {
@@ -330,12 +380,78 @@ jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
330
jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
331
}
332
});
333
jQuery(document).on('click', '.b2s-post-publish-area-drop-btn', function () {
334
jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
335
jQuery('#b2s-delete-confirm-post-count').html('1');
336
jQuery('.b2s-delete-publish-modal').modal('show');
337
jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
338
});
339
jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
340
jQuery('.b2s-post-remove-fail').hide();
341
jQuery('.b2s-post-remove-success').hide();
@@ -449,10 +565,22 @@ function showEditSchedPost(b2s_id, post_id, network_auth_id, network_type, netwo
449
jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
450
}
451
452
} else {
453
jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
454
jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
455
jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
456
}
457
}
458
@@ -641,3 +769,35 @@ function checkSchedDateTime() {
641
}
642
}
643
35
jQuery('body').addClass('modal-open');
36
});
37
38
+
39
+ function wopApprove(url, name) {
40
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
41
+ window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
42
+ }
43
+
44
jQuery(document).on('click', '.b2sDetailsPublishPostBtn', function () {
45
var postId = jQuery(this).attr('data-post-id');
46
var showByDate = jQuery(this).attr('data-search-date');
80
}
81
});
82
83
+ jQuery(document).on('click', '.b2sDetailsApprovePostBtn', function () {
84
+ var postId = jQuery(this).attr('data-post-id');
85
+ var showByDate = jQuery(this).attr('data-search-date');
86
+ if (!jQuery(this).find('i').hasClass('isload')) {
87
+ jQuery('.b2s-server-connection-fail').hide();
88
+ jQuery.ajax({
89
+ url: ajaxurl,
90
+ type: "POST",
91
+ dataType: "json",
92
+ cache: false,
93
+ data: {
94
+ 'action': 'b2s_approve_post_data',
95
+ 'postId': postId,
96
+ 'showByDate': showByDate
97
+ },
98
+ error: function () {
99
+ jQuery('.b2s-server-connection-fail').show();
100
+ return false;
101
+ },
102
+ success: function (data) {
103
+ if (data.result == true) {
104
+ jQuery('.b2s-post-approve-area[data-post-id="' + data.postId + '"]').html(data.content);
105
+ }
106
+ }
107
+ });
108
+ jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
109
+ } else {
110
+ if (jQuery(this).find('i').hasClass('isShow')) {
111
+ jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').hide();
112
+ jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
113
+ } else {
114
+ jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').show();
115
+ jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
116
+ }
117
+ }
118
+ });
119
+
120
121
jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
122
jQuery('#b2sPagination').val("1");
282
jQuery(this).parent().prev().find('button').trigger('click');
283
return false;
284
});
285
+
286
+ jQuery(document).on('click', '.b2sDetailsApprovePostTriggerLink', function () {
287
+ jQuery(this).parent().prev().find('button').trigger('click');
288
+ return false;
289
+ });
290
+
291
jQuery(document).on('click', '.b2sDetailsSchedPostTriggerLink', function () {
292
if (jQuery('#b2s-redirect-url-sched-post').val() == undefined || jQuery('#b2s-redirect-url-sched-post').val() === null) {
293
//self page blog2social-sched
366
}
367
});
368
});
369
+
370
jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
371
var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
372
if (checkboxes.length > 0) {
380
jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
381
}
382
});
383
+
384
+
385
+ jQuery(document).on('click', '.checkbox-post-approve-all-btn', function () {
386
+ var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
387
+ if (checkboxes.length > 0) {
388
+ var items = [];
389
+ jQuery(checkboxes).each(function (i, selected) {
390
+ items[i] = jQuery(selected).val();
391
+ });
392
+ jQuery('#b2s-delete-confirm-post-id').val(items.join());
393
+ jQuery('#b2s-delete-confirm-post-count').html(items.length);
394
+ jQuery('.b2s-delete-approve-modal').modal('show');
395
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
396
+ }
397
+ });
398
+
399
+
400
+ jQuery(document).on('click', '.b2s-approve-delete-confirm-btn', function () {
401
+ jQuery('.b2s-post-remove-fail').hide();
402
+ jQuery('.b2s-post-remove-success').hide();
403
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', true);
404
+ jQuery('.b2s-server-connection-fail').hide();
405
+ jQuery.ajax({
406
+ url: ajaxurl,
407
+ type: "POST",
408
+ dataType: "json",
409
+ cache: false,
410
+ data: {
411
+ 'action': 'b2s_delete_user_approve_post',
412
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val()
413
+ },
414
+ error: function () {
415
+ jQuery('.b2s-server-connection-fail').show();
416
+ return false;
417
+ },
418
+ success: function (data) {
419
+ jQuery('.b2s-delete-approve-modal').modal('hide');
420
+ if (data.result == true) {
421
+ var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html());
422
+ var newCount = count - data.postCount;
423
+ jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
424
+ if (newCount >= 1) {
425
+ jQuery.each(data.postId, function (i, id) {
426
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + id + '"]').remove();
427
+ });
428
+ } else {
429
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
430
+ }
431
+ jQuery('.b2s-post-remove-success').show();
432
+ } else {
433
+ jQuery('.b2s-post-remove-fail').show();
434
+ }
435
+ wp.heartbeat.connectNow();
436
+ return true;
437
+ }
438
+ });
439
+ });
440
+
441
+ jQuery(document).on('click', '.b2s-post-approve-area-drop-btn', function () {
442
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
443
+ jQuery('#b2s-delete-confirm-post-count').html('1');
444
+ jQuery('.b2s-delete-approve-modal').modal('show');
445
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
446
+ });
447
+
448
jQuery(document).on('click', '.b2s-post-publish-area-drop-btn', function () {
449
jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
450
jQuery('#b2s-delete-confirm-post-count').html('1');
451
jQuery('.b2s-delete-publish-modal').modal('show');
452
jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
453
});
454
+
455
jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
456
jQuery('.b2s-post-remove-fail').hide();
457
jQuery('.b2s-post-remove-success').hide();
565
jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
566
}
567
568
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
569
+ if (network_id == 1 && network_type == 0) {
570
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
571
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
572
+ }
573
+
574
} else {
575
jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
576
jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
577
jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
578
+
579
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
580
+ if (network_id == 1 && network_type == 0) {
581
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
582
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
583
+ }
584
}
585
}
586
769
}
770
}
771
772
+
773
+ window.addEventListener('message', function (e) {
774
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
775
+ var data = JSON.parse(e.data);
776
+ if (data.action == 'approve') {
777
+ var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.post_id + '"]').html());
778
+ var newCount = count - 1;
779
+ jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
780
+ if (newCount >= 1) {
781
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').remove();
782
+ } else {
783
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').closest('ul').closest('li').remove();
784
+ }
785
+ jQuery.ajax({
786
+ url: ajaxurl,
787
+ type: "POST",
788
+ cache: false,
789
+ async: false,
790
+ data: {
791
+ 'action': 'b2s_update_approve_post',
792
+ 'post_id': data.post_id,
793
+ 'publish_link': data.publish_link,
794
+ 'publish_error_code': data.publish_error_code,
795
+ },
796
+ success: function (data) {
797
+
798
+ }
799
+ });
800
+ }
801
+ }
802
+ });
803
+
assets/js/b2s/ship.js CHANGED
@@ -544,10 +544,24 @@ jQuery(document).on("click", ".b2s-user-network-settings-post-format", function
544
});
545
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
546
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
547
} else {
548
jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
549
jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
550
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
551
}
552
553
jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
@@ -668,6 +682,17 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
668
jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
669
jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
670
}
671
}
672
673
//Twitter TOS 032018 - protected multiple accounts with same content to same time
@@ -867,6 +892,18 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
867
jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
868
}
869
870
//Twitter TOS 032018 - protected multiple accounts with same content to same time
871
//delete comment field one more
872
if (data.networkId == 2) {
@@ -1057,6 +1094,7 @@ jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function ()
1057
return false;
1058
});
1059
jQuery(document).on('click', '.b2s-re-share-btn', function () {
1060
jQuery(".b2s-settings-user-sched-time-area").show();
1061
jQuery('#b2s-sidebar-wrapper').show();
1062
jQuery('.b2s-post-item-info-area').show();
@@ -1703,6 +1741,10 @@ jQuery("#b2sNetworkSent").validate({
1703
jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
1704
jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
1705
jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
1706
}
1707
jQuery(".b2s-post-area").show();
1708
jQuery('.b2s-publish-area').hide();
@@ -1819,7 +1861,25 @@ jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function (
1819
window.addEventListener('message', function (e) {
1820
if (e.origin == jQuery('#b2sServerUrl').val()) {
1821
var data = JSON.parse(e.data);
1822
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
1823
}
1824
});
1825
jQuery.xhrPool.abortAll = function () { // our abort function
@@ -2593,6 +2653,13 @@ function wop(url, name) {
2593
window.open(url, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
2594
}
2595
2596
function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId) {
2597
jQuery('.b2s-network-auth-success').show();
2598
jQuery('#b2s-network-list-modal').modal('hide');
544
});
545
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
546
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
547
+
548
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
549
+ if (networkId == 1 && networkType == 0) {
550
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
551
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
552
+ }
553
+
554
} else {
555
jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
556
jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
557
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
558
+
559
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
560
+ if (networkId == 1 && networkType == 0) {
561
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
562
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').show();
563
+ }
564
+
565
}
566
567
jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
682
jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
683
jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
684
}
685
+
686
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
687
+ if (networkId == 1 && networkType == 0) {
688
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == "1") {
689
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
690
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').show();
691
+ } else {
692
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
693
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
694
+ }
695
+ }
696
}
697
698
//Twitter TOS 032018 - protected multiple accounts with same content to same time
892
jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
893
}
894
895
+
896
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
897
+ if (data.networkId == 1 && data.networkType == 0) {
898
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == "1") {
899
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
900
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + data.networkAuthId + '"]').show();
901
+ } else {
902
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
903
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + data.networkAuthId + '"]').hide();
904
+ }
905
+ }
906
+
907
//Twitter TOS 032018 - protected multiple accounts with same content to same time
908
//delete comment field one more
909
if (data.networkId == 2) {
1094
return false;
1095
});
1096
jQuery(document).on('click', '.b2s-re-share-btn', function () {
1097
+ jQuery('.panel-group').removeClass('b2s-border-color-warning');
1098
jQuery(".b2s-settings-user-sched-time-area").show();
1099
jQuery('#b2s-sidebar-wrapper').show();
1100
jQuery('.b2s-post-item-info-area').show();
1741
jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
1742
jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
1743
jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
1744
+ jQuery('.b2s-post-approve-info').hide();
1745
+ if (typeof content[i]['approve'] !== typeof undefined) {
1746
+ jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
1747
+ }
1748
}
1749
jQuery(".b2s-post-area").show();
1750
jQuery('.b2s-publish-area').hide();
1861
window.addEventListener('message', function (e) {
1862
if (e.origin == jQuery('#b2sServerUrl').val()) {
1863
var data = JSON.parse(e.data);
1864
+ if (typeof data.action !== typeof undefined && data.action == 'approve') {
1865
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + data.networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
1866
+ jQuery.ajax({
1867
+ url: ajaxurl,
1868
+ type: "POST",
1869
+ cache: false,
1870
+ async: false,
1871
+ data: {
1872
+ 'action': 'b2s_update_approve_post',
1873
+ 'post_id': data.post_id,
1874
+ 'publish_link': data.publish_link,
1875
+ 'publish_error_code': data.publish_error_code,
1876
+ },
1877
+ success: function (data) {
1878
+ }
1879
+ });
1880
+ } else {
1881
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
1882
+ }
1883
}
1884
});
1885
jQuery.xhrPool.abortAll = function () { // our abort function
2653
window.open(url, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
2654
}
2655
2656
+
2657
+ function wopApprove(url, name) {
2658
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
2659
+ window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
2660
+ }
2661
+
2662
+
2663
function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId) {
2664
jQuery('.b2s-network-auth-success').show();
2665
jQuery('#b2s-network-list-modal').modal('hide');
blog2social.php CHANGED
@@ -7,12 +7,12 @@
7
* Author: Blog2Social, Adenion
8
* Text Domain: blog2social
9
* Domain Path: /languages
10
- * Version: 4.9.0
11
* Author URI: https://www.blog2social.com
12
* License: GPL2+
13
*/
14
//B2SDefine
15
- define('B2S_PLUGIN_VERSION', '490');
16
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
17
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
18
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
7
* Author: Blog2Social, Adenion
8
* Text Domain: blog2social
9
* Domain Path: /languages
10
+ * Version: 4.9.1
11
* Author URI: https://www.blog2social.com
12
* License: GPL2+
13
*/
14
//B2SDefine
15
+ define('B2S_PLUGIN_VERSION', '491');
16
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
17
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
18
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
includes/Ajax/Get.php CHANGED
@@ -18,6 +18,7 @@ class Ajax_Get {
18
add_action('wp_ajax_b2s_get_network_board_and_group', array($this, 'getNetworkBoardAndGroup'));
19
add_action('wp_ajax_b2s_publish_post_data', array($this, 'getPublishPostData'));
20
add_action('wp_ajax_b2s_sched_post_data', array($this, 'getSchedPostData'));
21
add_action('wp_ajax_b2s_ship_navbar_item', array($this, 'getNavbarItem'));
22
add_action('wp_ajax_b2s_post_meta_box', array($this, 'getPostMetaBox'));
23
add_action('wp_ajax_b2s_get_settings_sched_time_default', array($this, 'getSettingsSchedTimeDefault'));
@@ -53,7 +54,7 @@ class Ajax_Get {
53
$b2sSelectSchedDate = isset($_POST['b2sSchedDate']) ? trim($_POST['b2sSchedDate']) : "";
54
$b2sUserLang = isset($_POST['b2sUserLang']) ? trim($_POST['b2sUserLang']) : strtolower(substr(B2S_LANGUAGE, 0, 2));
55
$b2sResultsPerPage = isset($_POST['b2sPostsPerPage']) && intval($_POST['b2sPostsPerPage']) > 0 ? intval($_POST['b2sPostsPerPage']) : B2S_PLUGIN_POSTPERPAGE;
56
- if (!empty($b2sType) && in_array($b2sType, array('all', 'sched', 'publish', 'notice'))) {
57
$postItem = new B2S_Post_Item($b2sType, $b2sSortPostTitle, $b2sSortPostAuthor, $b2sSortPostStatus, $b2sSortPostPublishDate, $b2sSortPostSchedDate, $b2sShowByDate, $b2sUserAuthId, $b2sPostBlogId, $b2sPagination, $b2sSortPostCat, $b2sSortPostType, $b2sUserLang, $b2sResultsPerPage);
58
$result = array('result' => true, 'content' => $postItem->getItemHtml($b2sSelectSchedDate), 'schedDates' => json_encode($postItem->getCalendarSchedDate()));
59
if ($b2sShowPagination) {
@@ -149,6 +150,23 @@ class Ajax_Get {
149
echo json_encode(array('result' => false));
150
wp_die();
151
}
152
153
public function getSchedPostsByUserAuth() {
154
if ((int) $_POST['networkAuthId']) {
18
add_action('wp_ajax_b2s_get_network_board_and_group', array($this, 'getNetworkBoardAndGroup'));
19
add_action('wp_ajax_b2s_publish_post_data', array($this, 'getPublishPostData'));
20
add_action('wp_ajax_b2s_sched_post_data', array($this, 'getSchedPostData'));
21
+ add_action('wp_ajax_b2s_approve_post_data', array($this, 'getApprovePostData'));
22
add_action('wp_ajax_b2s_ship_navbar_item', array($this, 'getNavbarItem'));
23
add_action('wp_ajax_b2s_post_meta_box', array($this, 'getPostMetaBox'));
24
add_action('wp_ajax_b2s_get_settings_sched_time_default', array($this, 'getSettingsSchedTimeDefault'));
54
$b2sSelectSchedDate = isset($_POST['b2sSchedDate']) ? trim($_POST['b2sSchedDate']) : "";
55
$b2sUserLang = isset($_POST['b2sUserLang']) ? trim($_POST['b2sUserLang']) : strtolower(substr(B2S_LANGUAGE, 0, 2));
56
$b2sResultsPerPage = isset($_POST['b2sPostsPerPage']) && intval($_POST['b2sPostsPerPage']) > 0 ? intval($_POST['b2sPostsPerPage']) : B2S_PLUGIN_POSTPERPAGE;
57
+ if (!empty($b2sType) && in_array($b2sType, array('all', 'sched', 'publish', 'notice', 'approve'))) {
58
$postItem = new B2S_Post_Item($b2sType, $b2sSortPostTitle, $b2sSortPostAuthor, $b2sSortPostStatus, $b2sSortPostPublishDate, $b2sSortPostSchedDate, $b2sShowByDate, $b2sUserAuthId, $b2sPostBlogId, $b2sPagination, $b2sSortPostCat, $b2sSortPostType, $b2sUserLang, $b2sResultsPerPage);
59
$result = array('result' => true, 'content' => $postItem->getItemHtml($b2sSelectSchedDate), 'schedDates' => json_encode($postItem->getCalendarSchedDate()));
60
if ($b2sShowPagination) {
150
echo json_encode(array('result' => false));
151
wp_die();
152
}
153
+
154
+ public function getApprovePostData() {
155
+ if ((int) $_POST['postId']) {
156
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
157
+ require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
158
+ $postData = new B2S_Post_Item();
159
+ $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
160
+ $result = $postData->getApprovePostDataHtml((int) $_POST['postId'], $showByDate);
161
+ if ($result !== false) {
162
+ echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
163
+ wp_die();
164
+ }
165
+ }
166
+ echo json_encode(array('result' => false));
167
+ wp_die();
168
+ }
169
+
170
171
public function getSchedPostsByUserAuth() {
172
if ((int) $_POST['networkAuthId']) {
includes/Ajax/Post.php CHANGED
@@ -23,6 +23,7 @@ class Ajax_Post {
23
add_action('wp_ajax_b2s_save_network_board_and_group', array($this, 'saveNetworkBoardAndGroup'));
24
add_action('wp_ajax_b2s_delete_user_sched_post', array($this, 'deleteUserSchedPost'));
25
add_action('wp_ajax_b2s_delete_user_publish_post', array($this, 'deleteUserPublishPost'));
26
add_action('wp_ajax_b2s_user_network_settings', array($this, 'saveUserNetworkSettings'));
27
add_action('wp_ajax_b2s_save_social_meta_tags', array($this, 'saveSocialMetaTags'));
28
add_action('wp_ajax_b2s_reset_social_meta_tags', array($this, 'resetSocialMetaTags'));
@@ -39,6 +40,7 @@ class Ajax_Post {
39
add_action('wp_ajax_b2s_delete_post', array($this, 'b2sDeletePost'));
40
add_action('wp_ajax_b2s_edit_save_post', array($this, 'b2sEditSavePost'));
41
add_action("wp_ajax_b2s_get_calendar_release_locks", array($this, 'releaseLocks'));
42
add_action("wp_ajax_b2s_hide_rating", array($this, 'hideRating'));
43
add_action("wp_ajax_b2s_hide_premium_message", array($this, 'hidePremiumMessage'));
44
add_action("wp_ajax_b2s_hide_trail_message", array($this, 'hideTrailMessage'));
@@ -170,6 +172,9 @@ class Ajax_Post {
170
171
delete_option('B2S_PLUGIN_POST_META_TAGES_' . (int) $post['post_id']);
172
173
$options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
174
$optionNoCache = $options->_getOption('link_no_cache');
175
@@ -251,7 +256,7 @@ class Ajax_Post {
251
//mode: share now
252
$schedData = array();
253
if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 0) {
254
- $b2sShipSend->savePublishDetails(array_merge($defaultPostData, $sendData), $relayData);
255
//mode: schedule custom once times
256
} else if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 1 && isset($data['date'][0]) && isset($data['time'][0])) {
257
$schedData = array(
@@ -262,7 +267,7 @@ class Ajax_Post {
262
'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
263
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
264
'saveSetting' => isset($data['saveSchedSetting']) ? true : false);
265
- $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
266
$content = array_merge($content, $schedResult);
267
//mode: recurrently schedule
268
} else {
@@ -287,11 +292,16 @@ class Ajax_Post {
287
'saveSetting' => isset($data['saveSchedSetting']) ? true : false
288
);
289
290
- $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
291
$content = array_merge($content, $schedResult);
292
}
293
}
294
295
if (!empty($b2sShipSend->postData)) {
296
$sendResult = $b2sShipSend->postPublish();
297
$content = array_merge($content, $sendResult);
@@ -620,6 +630,19 @@ class Ajax_Post {
620
wp_die();
621
}
622
623
public function sendTrailFeedback() {
624
require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
625
if (isset($_POST['feedback']) && !empty($_POST['feedback'])) {
@@ -657,7 +680,7 @@ class Ajax_Post {
657
}
658
659
public function networkTosAccept() {
660
- update_option('B2S_PLUGIN_NETWORK_TOS_ACCEPT_032018_USER_' . B2S_PLUGIN_BLOG_USER_ID, 1);
661
echo json_encode(array('result' => true));
662
wp_die();
663
}
@@ -706,16 +729,47 @@ class Ajax_Post {
706
wp_die();
707
}
708
709
public function b2sCalendarMovePost() {
710
global $wpdb;
711
if (is_numeric($_POST['b2s_id']) && is_string($_POST['sched_date'])) {
712
$sql = "UPDATE b2s_posts "
713
. "SET sched_date = '" . date('Y-m-d H:i:s', strtotime($_POST['sched_date'])) . "', "
714
. "user_timezone = '" . $_POST['user_timezone'] . "', "
715
. "publish_date = '0000-00-00 00:00:00' ,"
716
. "sched_date_utc = '" . B2S_Util::getUTCForDate($_POST['sched_date'], $_POST['user_timezone'] * -1) . "', "
717
- . "hook_action = 2 "
718
- . "WHERE id = " . $_POST['b2s_id'];
719
$wpdb->query($sql);
720
721
//is post for relay?
@@ -763,7 +817,8 @@ class Ajax_Post {
763
$sql = $wpdb->prepare("SELECT id,post_id,post_for_relay FROM b2s_posts WHERE id =%d AND publish_date = %s", (int) $_POST['b2s_id'], "0000-00-00 00:00:00");
764
$row = $wpdb->get_row($sql);
765
if (isset($row->id) && (int) $row->id == (int) $_POST['b2s_id']) {
766
- $wpdb->update('b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => (int) $_POST['b2s_id']));
767
//is post for relay
768
if ((int) $row->post_for_relay == 1) {
769
$res = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
@@ -786,6 +841,7 @@ class Ajax_Post {
786
public function b2sEditSavePost() {
787
global $wpdb;
788
require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Save.php');
789
$post = $_POST;
790
$metaOg = false;
791
$metaCard = false;
@@ -904,6 +960,7 @@ class Ajax_Post {
904
'network_display_name' => isset($data['network_display_name']) ? $data['network_display_name'] : '',
905
'network_auth_id' => $networkAuthId,
906
'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
907
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
908
'sched_details_id' => isset($post['sched_details_id']) ? $post['sched_details_id'] : null,
909
'publish_date' => isset($post['publish_date']) ? date('Y-m-d H:i:s', strtotime($post['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp'))
@@ -918,7 +975,8 @@ class Ajax_Post {
918
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
919
'saveSetting' => isset($data['saveSchedSetting']) ? true : false
920
);
921
- $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData);
922
923
//is post for relay ?
924
//get all relays in primary post id by b2s id & change sched_date + utc
23
add_action('wp_ajax_b2s_save_network_board_and_group', array($this, 'saveNetworkBoardAndGroup'));
24
add_action('wp_ajax_b2s_delete_user_sched_post', array($this, 'deleteUserSchedPost'));
25
add_action('wp_ajax_b2s_delete_user_publish_post', array($this, 'deleteUserPublishPost'));
26
+ add_action('wp_ajax_b2s_delete_user_approve_post', array($this, 'deleteUserApprovePost'));
27
add_action('wp_ajax_b2s_user_network_settings', array($this, 'saveUserNetworkSettings'));
28
add_action('wp_ajax_b2s_save_social_meta_tags', array($this, 'saveSocialMetaTags'));
29
add_action('wp_ajax_b2s_reset_social_meta_tags', array($this, 'resetSocialMetaTags'));
40
add_action('wp_ajax_b2s_delete_post', array($this, 'b2sDeletePost'));
41
add_action('wp_ajax_b2s_edit_save_post', array($this, 'b2sEditSavePost'));
42
add_action("wp_ajax_b2s_get_calendar_release_locks", array($this, 'releaseLocks'));
43
+ add_action("wp_ajax_b2s_update_approve_post", array($this, 'updateApprovePost'));
44
add_action("wp_ajax_b2s_hide_rating", array($this, 'hideRating'));
45
add_action("wp_ajax_b2s_hide_premium_message", array($this, 'hidePremiumMessage'));
46
add_action("wp_ajax_b2s_hide_trail_message", array($this, 'hideTrailMessage'));
172
173
delete_option('B2S_PLUGIN_POST_META_TAGES_' . (int) $post['post_id']);
174
175
+ //since V4.9.1 Instant Share Approve - Facebook Profile
176
+ $shareApproveNetworkData = unserialize(B2S_PLUGIN_NETWORK_SHARE_APPROVE);
177
+
178
$options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
179
$optionNoCache = $options->_getOption('link_no_cache');
180
256
//mode: share now
257
$schedData = array();
258
if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 0) {
259
+ $b2sShipSend->savePublishDetails(array_merge($defaultPostData, $sendData), $relayData, $shareApproveNetworkData);
260
//mode: schedule custom once times
261
} else if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 1 && isset($data['date'][0]) && isset($data['time'][0])) {
262
$schedData = array(
267
'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
268
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
269
'saveSetting' => isset($data['saveSchedSetting']) ? true : false);
270
+ $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData, $shareApproveNetworkData);
271
$content = array_merge($content, $schedResult);
272
//mode: recurrently schedule
273
} else {
292
'saveSetting' => isset($data['saveSchedSetting']) ? true : false
293
);
294
295
+ $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData, $shareApproveNetworkData);
296
$content = array_merge($content, $schedResult);
297
}
298
}
299
300
+ if (!empty($b2sShipSend->postDataApprove)) {
301
+ $sendResult = $b2sShipSend->getShareApproveDetails();
302
+ $content = array_merge($content, $sendResult);
303
+ }
304
+
305
if (!empty($b2sShipSend->postData)) {
306
$sendResult = $b2sShipSend->postPublish();
307
$content = array_merge($content, $sendResult);
630
wp_die();
631
}
632
633
+ public function deleteUserApprovePost() {
634
+ require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
635
+ if (isset($_POST['postId']) && !empty($_POST['postId'])) {
636
+ $postIds = explode(',', $_POST['postId']);
637
+ if (is_array($postIds) && !empty($postIds)) {
638
+ echo json_encode(B2S_Post_Tools::deleteUserApprovePost($postIds));
639
+ wp_die();
640
+ }
641
+ }
642
+ echo json_encode(array('result' => false));
643
+ wp_die();
644
+ }
645
+
646
public function sendTrailFeedback() {
647
require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
648
if (isset($_POST['feedback']) && !empty($_POST['feedback'])) {
680
}
681
682
public function networkTosAccept() {
683
+ update_option('B2S_PLUGIN_NETWORK_TOS_ACCEPT_072018_USER_' . B2S_PLUGIN_BLOG_USER_ID, 1);
684
echo json_encode(array('result' => true));
685
wp_die();
686
}
729
wp_die();
730
}
731
732
+ public function updateApprovePost() {
733
+ //post_id
734
+ if (is_numeric($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
735
+ global $wpdb;
736
+ require_once (B2S_PLUGIN_DIR . '/includes/Options.php');
737
+ require_once (B2S_PLUGIN_DIR . '/includes/Util.php');
738
+ $option = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
739
+ $optionUserTimeZone = $option->_getOption('user_time_zone');
740
+ $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
741
+ $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
742
+
743
+ $sql = "UPDATE b2s_posts "
744
+ . "SET sched_date = '0000-00-00 00:00:00', "
745
+ . "sched_date_utc = '0000-00-00 00:00:00', "
746
+ . "publish_date = '" . B2S_Util::getbyIdentLocalDate($userTimeZoneOffset) . "', "
747
+ . "publish_link = '" . ((isset($_POST['publish_link']) && !empty($_POST['publish_link'])) ? addslashes(strip_tags($_POST['publish_link'])) : '') . "', "
748
+ . "publish_error_code = '" . ((isset($_POST['publish_error_code']) && !empty($_POST['publish_error_code'])) ? addslashes(strip_tags($_POST['publish_error_code'])) : '') . "', "
749
+ . "post_for_approve = 0 "
750
+ . "WHERE id = " . (int) $_POST['post_id'];
751
+ $wpdb->query($sql);
752
+ echo json_encode(array('result' => true));
753
+ wp_die();
754
+ }
755
+ }
756
+
757
public function b2sCalendarMovePost() {
758
+
759
global $wpdb;
760
if (is_numeric($_POST['b2s_id']) && is_string($_POST['sched_date'])) {
761
+
762
+ //since V4.9.1 Instant Share Approve - Facebook Profile
763
+ $shareApprove = (isset($_POST['post_for_approve']) && (int) $_POST['post_for_approve'] = 1) ? 1 : 0;
764
+
765
$sql = "UPDATE b2s_posts "
766
. "SET sched_date = '" . date('Y-m-d H:i:s', strtotime($_POST['sched_date'])) . "', "
767
. "user_timezone = '" . $_POST['user_timezone'] . "', "
768
. "publish_date = '0000-00-00 00:00:00' ,"
769
. "sched_date_utc = '" . B2S_Util::getUTCForDate($_POST['sched_date'], $_POST['user_timezone'] * -1) . "', "
770
+ . "hook_action = " . (($shareApprove == 0) ? 2 : 0)
771
+ . " WHERE id = " . $_POST['b2s_id'];
772
+
773
$wpdb->query($sql);
774
775
//is post for relay?
817
$sql = $wpdb->prepare("SELECT id,post_id,post_for_relay FROM b2s_posts WHERE id =%d AND publish_date = %s", (int) $_POST['b2s_id'], "0000-00-00 00:00:00");
818
$row = $wpdb->get_row($sql);
819
if (isset($row->id) && (int) $row->id == (int) $_POST['b2s_id']) {
820
+ $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
821
+ $wpdb->update('b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $_POST['b2s_id']));
822
//is post for relay
823
if ((int) $row->post_for_relay == 1) {
824
$res = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
841
public function b2sEditSavePost() {
842
global $wpdb;
843
require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Save.php');
844
+
845
$post = $_POST;
846
$metaOg = false;
847
$metaCard = false;
960
'network_display_name' => isset($data['network_display_name']) ? $data['network_display_name'] : '',
961
'network_auth_id' => $networkAuthId,
962
'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
963
+ 'post_for_approve' => isset($post['post_for_approve']) ? (int) $post['post_for_approve'] : 0,
964
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
965
'sched_details_id' => isset($post['sched_details_id']) ? $post['sched_details_id'] : null,
966
'publish_date' => isset($post['publish_date']) ? date('Y-m-d H:i:s', strtotime($post['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp'))
975
'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
976
'saveSetting' => isset($data['saveSchedSetting']) ? true : false
977
);
978
+
979
+ $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, array());
980
981
//is post for relay ?
982
//get all relays in primary post id by b2s id & change sched_date + utc
includes/B2S/AutoPost.php CHANGED
@@ -23,6 +23,7 @@ class B2S_AutoPost {
23
$this->current_user_date = $current_user_date;
24
$this->myTimeSettings = $myTimeSettings;
25
$this->title = $title;
26
$this->content = B2S_Util::prepareContent($postId, $content, $url, false, true, $b2sPostLang);
27
$this->contentHtml = B2S_Util::prepareContent($postId, $content, $url, '<p><h1><h2><br><i><b><a><img>', true, $b2sPostLang);
28
$this->url = $url;
@@ -31,8 +32,8 @@ class B2S_AutoPost {
31
$this->optionPostFormat = $optionPostFormat;
32
$this->allowHashTag = $allowHashTag;
33
$this->optionContentTwitter = $optionContentTwitter;
34
- $this->setPreFillText = array(0 => array(1 => 239, 2 => 255, 3 => 239, 6 => 300, 8 => 239, 9 => 200, 10 => 442, 12 => 240, 16 => 250,17 => 442, 18 => 800), 1 => array(1 => 239, 3 => 239, 8 => 1200, 10 => 442,17 => 442), 2 => array(1 => 239, 8 => 239, 10 => 442,17 => 442));
35
- $this->setPreFillTextLimit = array(0 => array(1 => 400, 2 => 256, 3 => 400, 6 => 400, 8 => 400,9 => 200, 10 => 500, 12 => 400, 18 => 1000), 1 => array(1 => 400, 3 => 400, 8 => 1200, 10 => 500), 2 => array(1 => 400, 8 => 400, 10 => 500));
36
}
37
38
public function prepareShareData($networkAuthId = 0, $networkId = 0, $networkType = 0) {
@@ -120,7 +121,7 @@ class B2S_AutoPost {
120
}
121
122
if ($networkId == 10 || $networkId == 17 || $networkId == 18) {
123
- $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (isset($this->setPreFillTextLimit[$networkType][$networkId])? (int) $this->setPreFillTextLimit[$networkType][$networkId] : false)) : $this->content;
124
if ($this->allowHashTag) {
125
$postData['content'] .= $this->getHashTagsString();
126
}
@@ -153,7 +154,7 @@ class B2S_AutoPost {
153
$hashTags = '';
154
if (is_array($this->keywords) && !empty($this->keywords)) {
155
foreach ($this->keywords as $tag) {
156
- $hashTags .= ' #' . str_replace(array(" ","-"), "", $tag->name);
157
}
158
}
159
return (!empty($hashTags) ? (!empty($add) ? $add . $hashTags : $hashTags) : '');
@@ -201,6 +202,9 @@ class B2S_AutoPost {
201
'network_display_name' => $network_display_name), array('%d', '%d', '%d', '%s'));
202
$networkDetailsId = $wpdb->insert_id;
203
}
204
if ($networkDetailsId > 0) {
205
$wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($shareData), 'image_url' => (isset($shareData['image_url']) ? $shareData['image_url'] : '')), array('%s', '%s'));
206
$schedDetailsId = $wpdb->insert_id;
@@ -214,7 +218,8 @@ class B2S_AutoPost {
214
'sched_date' => $sched_date,
215
'sched_date_utc' => $sched_date_utc,
216
'network_details_id' => $networkDetailsId,
217
- 'hook_action' => 1), array('%d', '%d', '%s', '%s', '%d', '%d', '%s', '%s', '%d', '%d'));
218
B2S_Rating::trigger();
219
}
220
}
23
$this->current_user_date = $current_user_date;
24
$this->myTimeSettings = $myTimeSettings;
25
$this->title = $title;
26
+ $this->shareApprove = unserialize(B2S_PLUGIN_NETWORK_SHARE_APPROVE);
27
$this->content = B2S_Util::prepareContent($postId, $content, $url, false, true, $b2sPostLang);
28
$this->contentHtml = B2S_Util::prepareContent($postId, $content, $url, '<p><h1><h2><br><i><b><a><img>', true, $b2sPostLang);
29
$this->url = $url;
32
$this->optionPostFormat = $optionPostFormat;
33
$this->allowHashTag = $allowHashTag;
34
$this->optionContentTwitter = $optionContentTwitter;
35
+ $this->setPreFillText = array(0 => array(1 => 239, 2 => 255, 3 => 239, 6 => 300, 8 => 239, 9 => 200, 10 => 442, 12 => 240, 16 => 250, 17 => 442, 18 => 800), 1 => array(1 => 239, 3 => 239, 8 => 1200, 10 => 442, 17 => 442), 2 => array(1 => 239, 8 => 239, 10 => 442, 17 => 442));
36
+ $this->setPreFillTextLimit = array(0 => array(1 => 400, 2 => 256, 3 => 400, 6 => 400, 8 => 400, 9 => 200, 10 => 500, 12 => 400, 18 => 1000), 1 => array(1 => 400, 3 => 400, 8 => 1200, 10 => 500), 2 => array(1 => 400, 8 => 400, 10 => 500));
37
}
38
39
public function prepareShareData($networkAuthId = 0, $networkId = 0, $networkType = 0) {
121
}
122
123
if ($networkId == 10 || $networkId == 17 || $networkId == 18) {
124
+ $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (isset($this->setPreFillTextLimit[$networkType][$networkId]) ? (int) $this->setPreFillTextLimit[$networkType][$networkId] : false)) : $this->content;
125
if ($this->allowHashTag) {
126
$postData['content'] .= $this->getHashTagsString();
127
}
154
$hashTags = '';
155
if (is_array($this->keywords) && !empty($this->keywords)) {
156
foreach ($this->keywords as $tag) {
157
+ $hashTags .= ' #' . str_replace(array(" ", "-"), "", $tag->name);
158
}
159
}
160
return (!empty($hashTags) ? (!empty($add) ? $add . $hashTags : $hashTags) : '');
202
'network_display_name' => $network_display_name), array('%d', '%d', '%d', '%s'));
203
$networkDetailsId = $wpdb->insert_id;
204
}
205
+
206
+ $shareApprove = (isset($this->shareApprove[(int) $network_type]) && is_array($this->shareApprove[(int) $network_type]) && in_array((int) $network_id, $this->shareApprove[(int) $network_type])) ? 1 : 0;
207
+
208
if ($networkDetailsId > 0) {
209
$wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($shareData), 'image_url' => (isset($shareData['image_url']) ? $shareData['image_url'] : '')), array('%s', '%s'));
210
$schedDetailsId = $wpdb->insert_id;
218
'sched_date' => $sched_date,
219
'sched_date_utc' => $sched_date_utc,
220
'network_details_id' => $networkDetailsId,
221
+ 'post_for_approve' => $shareApprove,
222
+ 'hook_action' => (($shareApprove == 0) ? 1 : 0)), array('%d', '%d', '%s', '%s', '%d', '%d', '%s', '%s', '%d', '%d', '%d'));
223
B2S_Rating::trigger();
224
}
225
}
includes/B2S/Calendar/Filter.php CHANGED
@@ -70,7 +70,7 @@ class B2S_Calendar_Filter {
70
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND b2s_posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
71
$addNetwork = ($network_id >= 1) ? $wpdb->prepare(' AND b2s_posts_network_details.`network_id` = %d', $network_id) : '';
72
$addNetworkDetails = ($network_details_id >= 1) ? $wpdb->prepare(' AND b2s_posts.`network_details_id` = %d', $network_details_id) : '';
73
-
74
75
$sql = "SELECT b2s_posts.sched_date, "
76
. "b2s_posts.blog_user_id, "
@@ -80,6 +80,7 @@ class B2S_Calendar_Filter {
80
. "b2s_posts.relay_primary_post_id, "
81
. "b2s_posts.relay_delay_min, "
82
. "b2s_posts.post_for_relay, "
83
. "b2s_posts_network_details.network_id, "
84
. "b2s_posts_network_details.network_type, "
85
. "b2s_posts_network_details.network_display_name, "
@@ -93,7 +94,7 @@ class B2S_Calendar_Filter {
93
. "LEFT JOIN b2s_posts_sched_details ON b2s_posts.sched_details_id = b2s_posts_sched_details.id "
94
. "INNER JOIN " . $wpdb->posts . " post ON post.ID = b2s_posts.post_id "
95
. "WHERE b2s_posts.publish_link = '' "
96
- . "AND b2s_posts.hide = 0 " . $addNotAdminPosts . $addNetwork . $addNetworkDetails . " ORDER BY sched_date";
97
98
99
$res = self::getBySql($sql);
@@ -105,6 +106,7 @@ class B2S_Calendar_Filter {
105
global $wpdb;
106
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND b2s_posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
107
$addNetwork = $wpdb->prepare(' AND b2s_posts_network_details.`network_id` = %d', $network_id);
108
109
$sql = "SELECT b2s_posts_network_details.network_type, "
110
. "b2s_posts_network_details.network_display_name, "
@@ -112,7 +114,7 @@ class B2S_Calendar_Filter {
112
. "FROM b2s_posts "
113
. "INNER JOIN b2s_posts_network_details ON b2s_posts.network_details_id = b2s_posts_network_details.id "
114
. "WHERE b2s_posts.sched_date != '0000-00-00 00:00:00' AND b2s_posts.publish_error_code= '' "
115
- . "AND b2s_posts.hide = '0' " . $addNotAdminPosts . $addNetwork . " GROUP BY b2s_posts.network_details_id";
116
117
$result = $wpdb->get_results($sql);
118
if (is_array($result) && !empty($result)) {
@@ -139,6 +141,7 @@ class B2S_Calendar_Filter {
139
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND b2s_posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
140
$addNetwork = ($network_id >= 1) ? $wpdb->prepare(' AND b2s_posts_network_details.`network_id` = %d', $network_id) : '';
141
$addNetworkDetails = ($network_details_id >= 1) ? $wpdb->prepare(' AND b2s_posts.`network_details_id` = %d', $network_details_id) : '';
142
143
144
$sql = "SELECT b2s_posts.sched_date, "
@@ -148,6 +151,7 @@ class B2S_Calendar_Filter {
148
. "b2s_posts.post_id, "
149
. "b2s_posts.relay_delay_min, "
150
. "b2s_posts.post_for_relay, "
151
. "b2s_posts.relay_primary_post_id, "
152
. "b2s_posts_network_details.network_id, "
153
. "b2s_posts_network_details.network_type, "
@@ -163,7 +167,7 @@ class B2S_Calendar_Filter {
163
. "INNER JOIN " . $wpdb->posts . " post ON post.ID = b2s_posts.post_id "
164
. "WHERE b2s_posts.publish_link = '' "
165
. "&& b2s_posts.sched_date BETWEEN '" . date('Y-m-d H:i:s', strtotime($start)) . "' AND '" . date('Y-m-d H:i:s', strtotime($end)) . "' "
166
- . "AND b2s_posts.hide = 0 " . $addNotAdminPosts . $addNetwork . $addNetworkDetails . " ORDER BY sched_date";
167
168
169
$res = self::getBySql($sql);
@@ -190,6 +194,7 @@ class B2S_Calendar_Filter {
190
. "b2s_posts.relay_primary_post_id, "
191
. "b2s_posts.relay_delay_min, "
192
. "b2s_posts.post_for_relay, "
193
. "b2s_posts_network_details.network_id, "
194
. "b2s_posts_network_details.network_type, "
195
. "b2s_posts_network_details.network_display_name, "
70
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND b2s_posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
71
$addNetwork = ($network_id >= 1) ? $wpdb->prepare(' AND b2s_posts_network_details.`network_id` = %d', $network_id) : '';
72
$addNetworkDetails = ($network_details_id >= 1) ? $wpdb->prepare(' AND b2s_posts.`network_details_id` = %d', $network_details_id) : '';
73
+ $approvePosts = " AND (b2s_posts.`sched_date_utc` != '0000-00-00 00:00:00' AND b2s_posts.`post_for_approve` = 0)OR (b2s_posts.`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND b2s_posts.`post_for_approve` = 1)";
74
75
$sql = "SELECT b2s_posts.sched_date, "
76
. "b2s_posts.blog_user_id, "
80
. "b2s_posts.relay_primary_post_id, "
81
. "b2s_posts.relay_delay_min, "
82
. "b2s_posts.post_for_relay, "
83
+ . "b2s_posts.post_for_approve, "
84
. "b2s_posts_network_details.network_id, "
85
. "b2s_posts_network_details.network_type, "
86
. "b2s_posts_network_details.network_display_name, "
94
. "LEFT JOIN b2s_posts_sched_details ON b2s_posts.sched_details_id = b2s_posts_sched_details.id "
95
. "INNER JOIN " . $wpdb->posts . " post ON post.ID = b2s_posts.post_id "
96
. "WHERE b2s_posts.publish_link = '' "
97
+ . "AND b2s_posts.hide = 0 " . $approvePosts . $addNotAdminPosts . $addNetwork . $addNetworkDetails . " ORDER BY sched_date";
98
99
100
$res = self::getBySql($sql);
106
global $wpdb;
107
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND b2s_posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
108
$addNetwork = $wpdb->prepare(' AND b2s_posts_network_details.`network_id` = %d', $network_id);
109
+ $approvePosts = " AND (b2s_posts.`sched_date_utc` != '0000-00-00 00:00:00' AND b2s_posts.`post_for_approve` = 0)OR (b2s_posts.`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND b2s_posts.`post_for_approve` = 1)";
110
111
$sql = "SELECT b2s_posts_network_details.network_type, "
112
. "b2s_posts_network_details.network_display_name, "
114
. "FROM b2s_posts "
115
. "INNER JOIN b2s_posts_network_details ON b2s_posts.network_details_id = b2s_posts_network_details.id "
116
. "WHERE b2s_posts.sched_date != '0000-00-00 00:00:00' AND b2s_posts.publish_error_code= '' "
117
+ . "AND b2s_posts.hide = '0' " . $approvePosts . $addNotAdminPosts . $addNetwork . " GROUP BY b2s_posts.network_details_id";
118
119
$result = $wpdb->get_results($sql);
120
if (is_array($result) && !empty($result)) {
141
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND b2s_posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
142
$addNetwork = ($network_id >= 1) ? $wpdb->prepare(' AND b2s_posts_network_details.`network_id` = %d', $network_id) : '';
143
$addNetworkDetails = ($network_details_id >= 1) ? $wpdb->prepare(' AND b2s_posts.`network_details_id` = %d', $network_details_id) : '';
144
+ $approvePosts = " AND (b2s_posts.`sched_date_utc` != '0000-00-00 00:00:00' AND b2s_posts.`post_for_approve` = 0)OR (b2s_posts.`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND b2s_posts.`post_for_approve` = 1)";
145
146
147
$sql = "SELECT b2s_posts.sched_date, "
151
. "b2s_posts.post_id, "
152
. "b2s_posts.relay_delay_min, "
153
. "b2s_posts.post_for_relay, "
154
+ . "b2s_posts.post_for_approve, "
155
. "b2s_posts.relay_primary_post_id, "
156
. "b2s_posts_network_details.network_id, "
157
. "b2s_posts_network_details.network_type, "
167
. "INNER JOIN " . $wpdb->posts . " post ON post.ID = b2s_posts.post_id "
168
. "WHERE b2s_posts.publish_link = '' "
169
. "&& b2s_posts.sched_date BETWEEN '" . date('Y-m-d H:i:s', strtotime($start)) . "' AND '" . date('Y-m-d H:i:s', strtotime($end)) . "' "
170
+ . "AND b2s_posts.hide = 0 " . $approvePosts . $addNotAdminPosts . $addNetwork . $addNetworkDetails . " ORDER BY sched_date";
171
172
173
$res = self::getBySql($sql);
194
. "b2s_posts.relay_primary_post_id, "
195
. "b2s_posts.relay_delay_min, "
196
. "b2s_posts.post_for_relay, "
197
+ . "b2s_posts.post_for_approve, "
198
. "b2s_posts_network_details.network_id, "
199
. "b2s_posts_network_details.network_type, "
200
. "b2s_posts_network_details.network_display_name, "
includes/B2S/Calendar/Item.php CHANGED
@@ -22,6 +22,7 @@ class B2S_Calendar_Item {
22
private $relay_primary_post_id = null;
23
private $relay_primary_sched_date = null;
24
private $post_for_relay = null;
25
private $relay_delay_min = null;
26
27
public function __construct(\StdClass $data = null) {
@@ -41,7 +42,8 @@ class B2S_Calendar_Item {
41
->setSchedDetailsId($data->sched_details_id)
42
->setImageUrl($data->image_url)
43
->setRelayPrimaryPostId($data->relay_primary_post_id)
44
- ->setPostForRelay($data->post_for_relay);
45
46
if ($data->network_id == 1 || $data->network_id == 2) {
47
$this->setPostFormat();
@@ -49,14 +51,10 @@ class B2S_Calendar_Item {
49
if ($data->network_id == 2 && isset($data->relay_primary_sched_date)) {
50
$this->setRelayPrimarySchedDate($data->relay_primary_sched_date);
51
$this->setRelayDelayMin($data->relay_delay_min);
52
-
53
}
54
}
55
}
56
57
- //post_for_relay
58
-
59
-
60
public function setPostForRelay($value) {
61
$this->post_for_relay = (int) $value;
62
return $this;
@@ -66,6 +64,15 @@ class B2S_Calendar_Item {
66
return $this->post_for_relay;
67
}
68
69
public function setRelayDelayMin($value) {
70
$this->relay_delay_min = (int) $value;
71
return $this;
@@ -438,6 +445,7 @@ class B2S_Calendar_Item {
438
"post_format" => $this->getPostFormat(),
439
"relay_primary_post_id" => $this->getRelayPrimaryPostId(),
440
"post_for_relay" => $this->getPostForRelay(),
441
"b2s_id" => $this->getB2SId(),
442
"post_id" => $this->getPostId(),
443
"user_timezone" => $this->getUserTimezone(),
@@ -476,6 +484,7 @@ class B2S_Calendar_Item {
476
'image_url' => $this->getImageUrl(),
477
'relay_primary_post_id' => $this->getRelayPrimaryPostId(),
478
'post_for_relay' => $this->getPostForRelay(),
479
'view' => $view);
480
481
return $this->ship_item()->getItemHtml((object) $itemData, false);
22
private $relay_primary_post_id = null;
23
private $relay_primary_sched_date = null;
24
private $post_for_relay = null;
25
+ private $post_for_approve = null;
26
private $relay_delay_min = null;
27
28
public function __construct(\StdClass $data = null) {
42
->setSchedDetailsId($data->sched_details_id)
43
->setImageUrl($data->image_url)
44
->setRelayPrimaryPostId($data->relay_primary_post_id)
45
+ ->setPostForRelay($data->post_for_relay)
46
+ ->setPostForApprove($data->post_for_approve);
47
48
if ($data->network_id == 1 || $data->network_id == 2) {
49
$this->setPostFormat();
51
if ($data->network_id == 2 && isset($data->relay_primary_sched_date)) {
52
$this->setRelayPrimarySchedDate($data->relay_primary_sched_date);
53
$this->setRelayDelayMin($data->relay_delay_min);
54
}
55
}
56
}
57
58
public function setPostForRelay($value) {
59
$this->post_for_relay = (int) $value;
60
return $this;
64
return $this->post_for_relay;
65
}
66
67
+ public function setPostForApprove($value) {
68
+ $this->post_for_approve = (int) $value;
69
+ return $this;
70
+ }
71
+
72
+ public function getPostForApprove() {
73
+ return $this->post_for_approve;
74
+ }
75
+
76
public function setRelayDelayMin($value) {
77
$this->relay_delay_min = (int) $value;
78
return $this;
445
"post_format" => $this->getPostFormat(),
446
"relay_primary_post_id" => $this->getRelayPrimaryPostId(),
447
"post_for_relay" => $this->getPostForRelay(),
448
+ "post_for_approve" => $this->getPostForApprove(),
449
"b2s_id" => $this->getB2SId(),
450
"post_id" => $this->getPostId(),
451
"user_timezone" => $this->getUserTimezone(),
484
'image_url' => $this->getImageUrl(),
485
'relay_primary_post_id' => $this->getRelayPrimaryPostId(),
486
'post_for_relay' => $this->getPostForRelay(),
487
+ 'post_for_approve' => $this->getPostForApprove(),
488
'view' => $view);
489
490
return $this->ship_item()->getItemHtml((object) $itemData, false);
includes/B2S/Heartbeat.php CHANGED
@@ -43,8 +43,8 @@ class B2S_Heartbeat {
43
. "LEFT JOIN b2s_posts_network_details AS network on post.network_details_id = network.id "
44
. "LEFT JOIN b2s_posts_sched_details AS schedDetails on post.sched_details_id = schedDetails.id "
45
. "LEFT JOIN b2s_user AS user on post.blog_user_id = user.blog_user_id "
46
- . "WHERE sched_date !='0000-00-00 00:00:00' AND sched_date_utc !='0000-00-00 00:00:00' AND post.hook_action= %d AND post.hide=%d ";
47
- $postData = $wpdb->get_results($wpdb->prepare($sql, 1, 0), ARRAY_A);
48
49
foreach ($postData as $k => $value) {
50
$data = array('hook_action' => '0');
@@ -88,8 +88,8 @@ class B2S_Heartbeat {
88
$networkTypeData = array('profil' => 0, 'page' => 1, 'group' => 2);
89
global $wpdb;
90
$sql = "SELECT posts.id, posts.user_timezone, posts.sched_date, posts.sched_date_utc, posts.v2_id, user.token FROM b2s_posts as posts "
91
- . "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
92
- $select = $wpdb->prepare($sql, '0000-00-00 00:00:00', gmdate('Y-m-d H:i:s'), 0); //,'0000-00-00 00:00:00'
93
$sendData = $wpdb->get_results($select, ARRAY_A);
94
95
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
@@ -176,14 +176,29 @@ class B2S_Heartbeat {
176
//V3
177
$publishTime = strtotime($v->publish_date);
178
if ((int) $v->id > 0 && $publishTime != false) {
179
$updateData = array(
180
'sched_date' => '0000-00-00 00:00:00',
181
'sched_date_utc' => '0000-00-00 00:00:00',
182
'publish_date' => date('Y-m-d H:i:s', $publishTime),
183
- 'publish_link' => strip_tags($v->publish_link),
184
- 'publish_error_code' => strip_tags($v->publish_error_code),
185
'hook_action' => 0);
186
- $wpdb->update('b2s_posts', $updateData, array('id' => $v->id), array('%s', '%s', '%s', '%s', '%s', '%d'), array('%d'));
187
}
188
}
189
}
@@ -222,8 +237,8 @@ class B2S_Heartbeat {
222
global $wpdb;
223
$sql = "SELECT posts.id, posts.sched_date, posts.sched_date_utc,schedDetails.sched_data, schedDetails.image_url,user.token FROM b2s_posts as posts "
224
. "LEFT JOIN b2s_posts_sched_details AS schedDetails on posts.sched_details_id = schedDetails.id "
225
- . "LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE hook_action = %d";
226
- $sendData = $wpdb->get_results($wpdb->prepare($sql, 5), ARRAY_A);
227
228
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
229
foreach ($sendData as $k => $value) {
@@ -247,8 +262,8 @@ class B2S_Heartbeat {
247
248
private function deleteUserSchedPost() {
249
global $wpdb;
250
- $sql = "SELECT posts.id, posts.v2_id, user.token FROM b2s_posts as posts LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE hook_action = %d";
251
- $sendData = $wpdb->get_results($wpdb->prepare($sql, 3), ARRAY_A);
252
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
253
foreach ($sendData as $k => $value) {
254
$data = array('hook_action' => '0');
@@ -271,8 +286,8 @@ class B2S_Heartbeat {
271
272
private function deleteUserPublishPost() {
273
global $wpdb;
274
- $sql = "SELECT posts.id, user.token FROM b2s_posts as posts LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE hook_action = %d";
275
- $sendData = $wpdb->get_results($wpdb->prepare($sql, 4), ARRAY_A);
276
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
277
foreach ($sendData as $k => $value) {
278
$data = array('hook_action' => '0');
43
. "LEFT JOIN b2s_posts_network_details AS network on post.network_details_id = network.id "
44
. "LEFT JOIN b2s_posts_sched_details AS schedDetails on post.sched_details_id = schedDetails.id "
45
. "LEFT JOIN b2s_user AS user on post.blog_user_id = user.blog_user_id "
46
+ . "WHERE sched_date !='0000-00-00 00:00:00' AND sched_date_utc !='0000-00-00 00:00:00' AND post.hook_action= %d AND post.hide=%d AND post.post_for_approve= %d ";
47
+ $postData = $wpdb->get_results($wpdb->prepare($sql, 1, 0, 0), ARRAY_A);
48
49
foreach ($postData as $k => $value) {
50
$data = array('hook_action' => '0');
88
$networkTypeData = array('profil' => 0, 'page' => 1, 'group' => 2);
89
global $wpdb;
90
$sql = "SELECT posts.id, posts.user_timezone, posts.sched_date, posts.sched_date_utc, posts.v2_id, user.token FROM b2s_posts as posts "
91
+ . "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.post_for_approve = %d"; //AND posts.publish_date = %s
92
+ $select = $wpdb->prepare($sql, '0000-00-00 00:00:00', gmdate('Y-m-d H:i:s'), 0, 0); //,'0000-00-00 00:00:00'
93
$sendData = $wpdb->get_results($select, ARRAY_A);
94
95
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
176
//V3
177
$publishTime = strtotime($v->publish_date);
178
if ((int) $v->id > 0 && $publishTime != false) {
179
+ //since V4.9.1 - check by error is old scheduled instant sharing post
180
+ $shareApprove = 0;
181
+ if (!empty($v->publish_error_code)) {
182
+ $sql = "SELECT details.network_id, details.network_type FROM b2s_posts as posts "
183
+ . "LEFT JOIN b2s_posts_network_details AS details on posts.network_details_id = details.id WHERE posts.id = %d";
184
+ $getNetworkDetails = $wpdb->get_results($wpdb->prepare($sql, $v->id), ARRAY_A);
185
+ if (is_array($getNetworkDetails) && !empty($getNetworkDetails) && isset($getNetworkDetails[0]['network_id']) && isset($getNetworkDetails[0]['network_type'])) {
186
+ $shareApproveNetworkData = unserialize(B2S_PLUGIN_NETWORK_SHARE_APPROVE);
187
+ if (isset($shareApproveNetworkData[(int) $getNetworkDetails[0]['network_type']]) && in_array((int) $getNetworkDetails[0]['network_id'], $shareApproveNetworkData[(int) $getNetworkDetails[0]['network_type']])) {
188
+ $shareApprove = 1;
189
+ }
190
+ }
191
+ }
192
+
193
$updateData = array(
194
'sched_date' => '0000-00-00 00:00:00',
195
'sched_date_utc' => '0000-00-00 00:00:00',
196
'publish_date' => date('Y-m-d H:i:s', $publishTime),
197
+ 'publish_link' => (($shareApprove == 0) ? strip_tags($v->publish_link) : ''),
198
+ 'publish_error_code' => (($shareApprove == 0) ? strip_tags($v->publish_error_code) : ''),
199
+ 'post_for_approve' => (int)$shareApprove,
200
'hook_action' => 0);
201
+ $wpdb->update('b2s_posts', $updateData, array('id' => $v->id), array('%s', '%s', '%s', '%s', '%s', '%d', '%d'), array('%d'));
202
}
203
}
204
}
237
global $wpdb;
238
$sql = "SELECT posts.id, posts.sched_date, posts.sched_date_utc,schedDetails.sched_data, schedDetails.image_url,user.token FROM b2s_posts as posts "
239
. "LEFT JOIN b2s_posts_sched_details AS schedDetails on posts.sched_details_id = schedDetails.id "
240
+ . "LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE hook_action = %d AND post_for_approve = %d";
241
+ $sendData = $wpdb->get_results($wpdb->prepare($sql, 5, 0), ARRAY_A);
242
243
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
244
foreach ($sendData as $k => $value) {
262
263
private function deleteUserSchedPost() {
264
global $wpdb;
265
+ $sql = "SELECT posts.id, posts.v2_id, user.token FROM b2s_posts as posts LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE hook_action = %d AND post_for_approve = %d";
266
+ $sendData = $wpdb->get_results($wpdb->prepare($sql, 3, 0), ARRAY_A);
267
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
268
foreach ($sendData as $k => $value) {
269
$data = array('hook_action' => '0');
286
287
private function deleteUserPublishPost() {
288
global $wpdb;
289
+ $sql = "SELECT posts.id, user.token FROM b2s_posts as posts LEFT JOIN b2s_user AS user on posts.blog_user_id = user.blog_user_id WHERE hook_action = %d AND post_for_approve = %d";
290
+ $sendData = $wpdb->get_results($wpdb->prepare($sql, 4, 0), ARRAY_A);
291
if (is_array($sendData) && !empty($sendData) && isset($sendData[0])) {
292
foreach ($sendData as $k => $value) {
293
$data = array('hook_action' => '0');
includes/B2S/Post/Item.php CHANGED
@@ -116,19 +116,29 @@ class B2S_Post_Item {
116
$this->postTotal = $wpdb->get_var($sqlPostsTotal);
117
}
118
119
- if ($this->type == 'publish' || $this->type == 'notice' || $this->type == 'sched') {
120
//ExistsTable
121
if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts'") == 'b2s_posts') {
122
- $addWhere = ($this->type == 'notice') ? ' AND a.`publish_error_code` != "" ' : ' AND a.`publish_error_code` = "" ';
123
- $where = ($this->type == 'publish' || $this->type == 'notice') ? " a.`hide` = 0 AND (a.`sched_date`= '0000-00-00 00:00:00' OR a.`sched_type` = 3) $addWhere $addNotAdminPosts GROUP BY a.`post_id` ORDER BY a.`publish_date` " . $sortType : " a.`hide` = 0 AND a.`sched_type` != 3 AND a.`publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts GROUP BY a.`post_id` ORDER BY a.`sched_date` " . $sortType;
124
- $orderBy = ($this->type == 'publish' || $this->type == 'notice') ? " ORDER BY filter.`publish_date` " . $sortType : " ORDER BY filter.`sched_date` " . $sortType;
125
- $addSearchBlogPostId = ((int) $this->searchBlogPostId != 0) ? " a.`post_id` = " . (int) $this->searchBlogPostId . " AND " : '';
126
- $addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish' || $this->type == 'notice') ? " DATE_FORMAT(a.`publish_date`,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND " : " DATE_FORMAT(a.`sched_date`,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND ") : '';
127
$addInnerJoinLeftJoin = ((int) $this->searchUserAuthId != 0) ? ' LEFT JOIN b2s_posts_network_details b ON b.`id` = a.`network_details_id` ' : '';
128
$addInnnerJoinLeftJoinWhere = ((int) $this->searchUserAuthId != 0) ? ' b.`network_auth_id` =' . $this->searchUserAuthId . ' AND ' : '';
129
130
- $select = ($this->type == 'publish' || $this->type == 'notice') ? 'filter.`blog_user_id`, filter.`publish_date`' : 'filter.`blog_user_id`, filter.`sched_date`';
131
- $selectInnerJoin = ($this->type == 'publish' || $this->type == 'notice') ? '`publish_date`' : '`sched_date`';
132
$sqlPosts = "SELECT posts.`ID`, posts.`post_author`,posts.`post_type`,posts.`post_title`, " . $select . ", filter.`id`
133
FROM `$wpdb->posts` posts $leftJoin $leftJoin2
134
INNER JOIN(
@@ -142,7 +152,7 @@ class B2S_Post_Item {
142
143
$this->postData = $wpdb->get_results($sqlPosts);
144
145
- if ($this->type == 'publish' || $this->type == 'notice') {
146
$sqlPostsTotal = "SELECT COUNT(posts.`ID`)
147
FROM `$wpdb->posts` posts $leftJoin $leftJoin2
148
INNER JOIN(
@@ -153,10 +163,9 @@ class B2S_Post_Item {
153
ON posts.`ID` = filter.`post_id`
154
WHERE $addSearchType $addSearchAuthorId $addSearchPostTitle AND $postTypes $leftJoinWhere";
155
$this->postTotal = $wpdb->get_var($sqlPostsTotal);
156
-
157
//for Calender (mark Event)
158
} else {
159
- $where = ($this->type == 'publish' || $this->type == 'notice') ? " a.`hide` = 0 AND (a.`sched_date`= '0000-00-00 00:00:00' OR a.`sched_type` = 3) $addWhere $addNotAdminPosts ORDER BY a.`publish_date` " . $sortType : " a.`hide` = 0 AND a.`sched_type` != 3 AND a.`publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts ORDER BY a.`sched_date` " . $sortType;
160
$sqlPostsTotal = "SELECT posts.`ID`, DATE_FORMAT(filter.`sched_date`,'%Y-%m-%d') AS sched
161
FROM `$wpdb->posts` posts $leftJoin $leftJoin2
162
INNER JOIN(
@@ -166,7 +175,7 @@ class B2S_Post_Item {
166
) filter
167
ON posts.`ID` = filter.`post_id`
168
WHERE $addSearchType $addSearchAuthorId $addSearchPostTitle AND $postTypes $leftJoinWhere";
169
-
170
$schedResult = $wpdb->get_results($sqlPostsTotal);
171
if (is_array($schedResult) && !empty($schedResult)) {
172
$this->postCalendarSchedDates = array();
@@ -257,6 +266,7 @@ class B2S_Post_Item {
257
$userInfo = get_user_meta($var->blog_user_id);
258
$schedPublish = $this->getPostCount($var->ID);
259
$nextSched = $this->getLastPost($var->ID);
260
$this->postItem .= '<li class="list-group-item">
261
<div class="media">
262
<img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
@@ -275,6 +285,28 @@ class B2S_Post_Item {
275
</div>
276
</li>';
277
}
278
}
279
280
return html_entity_decode($this->postItem, ENT_COMPAT, 'UTF-8');
@@ -284,11 +316,18 @@ class B2S_Post_Item {
284
if ($post_id > 0) {
285
global $wpdb;
286
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
287
- $addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish' || $this->type == 'notice') ? " AND DATE_FORMAT(posts.publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' " : " AND DATE_FORMAT(posts.sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' ") : '';
288
$addLeftJoin = ((int) $this->searchUserAuthId != 0) ? ' LEFT JOIN b2s_posts_network_details details ON details.`id` = posts.`network_details_id` ' : '';
289
$addLeftJoinWhere = ((int) $this->searchUserAuthId != 0) ? ' details.`network_auth_id` =' . $this->searchUserAuthId . ' AND ' : '';
290
- $addWhere = ($this->type == 'notice') ? ' AND posts.`publish_error_code` != "" ' : ' AND posts.`publish_error_code` = "" ';
291
- $where = ($this->type == 'publish' || $this->type == 'notice') ? " (posts.`sched_date`= '0000-00-00 00:00:00' OR posts.`sched_type` = 3) " . $addWhere : " posts.`sched_type` != 3 AND posts.`publish_date` = '0000-00-00 00:00:00'";
292
$sqlPostsTotal = "SELECT COUNT(posts.`post_id`) FROM `b2s_posts` posts $addLeftJoin WHERE $addLeftJoinWhere $where $addNotAdmin $addSearchShowByDate AND posts.`hide` = 0 AND posts.`post_id` = " . $post_id;
293
return $wpdb->get_var($sqlPostsTotal);
294
}
@@ -301,7 +340,7 @@ class B2S_Post_Item {
301
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
302
$order = ($this->type == 'publish' || $this->type == 'notice') ? " `publish_date` DESC" : " `sched_date` ASC ";
303
$addWhere = ($this->type == 'notice') ? ' AND `publish_error_code` != "" ' : ' AND `publish_error_code` = "" ';
304
- $where = ($this->type == 'publish' || $this->type == 'notice') ? " (`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) " . $addWhere : " `sched_type` != 3 AND `publish_date` = '0000-00-00 00:00:00'";
305
$fields = ($this->type == 'publish' || $this->type == 'notice') ? "publish_date" : "sched_date";
306
$sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
307
return $wpdb->get_var($sqlLast);
@@ -316,7 +355,7 @@ class B2S_Post_Item {
316
$order = "`publish_date` DESC";
317
$where = "(`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) ";
318
$fields = "publish_date";
319
- $sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
320
$result = $wpdb->get_results($sqlLast);
321
if (!empty($result) && isset($result[0]->publish_date)) {
322
return $result[0]->publish_date;
@@ -369,9 +408,9 @@ class B2S_Post_Item {
369
$addNotAdminPosts = (!B2S_PLUGIN_ADMIN) ? (' AND blog_user_id =' . B2S_PLUGIN_BLOG_USER_ID) : '';
370
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`publish_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
371
$addWhere = ($type == 'notice') ? ' AND `b2s_posts`.`publish_error_code` != "" ' : ' AND `b2s_posts`.`publish_error_code` = "" ';
372
- $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) $addWhere $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`publish_date` DESC", $post_id);
373
$result = $wpdb->get_results($sqlData);
374
- $specialPostingData = array(3 => __('Auto-Posting', 'blog2social') , 4 => __('Retweet', 'blog2social'));
375
if (!empty($result) && is_array($result)) {
376
$networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
377
$networkName = unserialize(B2S_PLUGIN_NETWORK);
@@ -413,10 +452,8 @@ class B2S_Post_Item {
413
<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 . $specialPosting . '</p>
414
<p class="info">' . $publishLink;
415
416
- if (!empty($var->publish_link) || !empty($var->publish_error_code)) {
417
- $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="#b2sPreFeatureModal" >';
418
- $content .= __('delete from reporting', 'blog2social') . '</a> ';
419
- }
420
421
if (!empty($error)) {
422
$content .= '| <a href="admin.php?page=blog2social-ship&postId=' . $post_id . '&network_auth_id=' . $var->network_auth_id . '">' . __('re-share', 'blog2social') . '</a>';
@@ -437,13 +474,73 @@ class B2S_Post_Item {
437
return false;
438
}
439
440
public function getSchedPostDataHtml($post_id = 0, $showByDate = '', $userAuthId = 0) {
441
if ($post_id > 0) {
442
global $wpdb;
443
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `b2s_posts`.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
444
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`sched_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
445
$addSearchUserAuthId = ($userAuthId != 0) ? " AND `b2s_posts_network_details`.`network_auth_id` =" . $userAuthId . " " : '';
446
- $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`, `b2s_posts`.`post_id`,`blog_user_id`,`v2_id`, `sched_date`,`sched_type`, `relay_primary_post_id`, `b2s_posts_network_details`.`network_id`,`b2s_posts_network_details`.`network_auth_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 $addSearchUserAuthId AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`sched_date` ASC ", $post_id);
447
$result = $wpdb->get_results($sqlData);
448
$specialPostingData = array(4 => __('Retweet', 'blog2social'));
449
if (!empty($result) && is_array($result)) {
@@ -462,12 +559,12 @@ class B2S_Post_Item {
462
$content .='<img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype">
463
<div class="media-body">
464
<strong>' . $networkName[$var->network_id] . '</strong>
465
- <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> '.$specialPosting.'</p>
466
<p class="info">';
467
468
if ((int) $var->v2_id == 0) {
469
//data-blog-sched-date="' . $blogPostDate . '" data-b2s-sched-date="' . strtotime($var->sched_date) . '000"
470
- $content .= (B2S_PLUGIN_USER_VERSION > 0) ? ' <a href="#" class="b2s-post-edit-sched-btn" data-network-auth-id="' . $var->network_auth_id . '" data-network-type="' . $var->network_type . '" data-network-id="' . $var->network_id . '" data-post-id="' . $var->post_id . '" data-b2s-id="' . $var->id . '" data-relay-primary-post-id="'.$var->relay_primary_post_id.'" >' : ' <a href="#" data-toggle="modal" data-title="' . __('You want to edit your scheduled post?', 'blog2social') . '" data-target="#b2sPreFeatureModal">';
471
$content .= __('edit', 'blog2social') . '</a> ';
472
$content .= '|';
473
}
116
$this->postTotal = $wpdb->get_var($sqlPostsTotal);
117
}
118
119
+ if ($this->type == 'publish' || $this->type == 'notice' || $this->type == 'sched' || $this->type == 'approve') {
120
//ExistsTable
121
if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts'") == 'b2s_posts') {
122
+ if ($this->type == 'approve') {
123
+ $addWhere = "";
124
+ $where = " a.`hide` = 0 AND a.`post_for_approve` = 1 AND (a.`publish_date` != '0000-00-00 00:00:00' OR a.`sched_date_utc` <= '" . gmdate('Y-m-d H:i:s') . "') $addNotAdminPosts GROUP BY a.`post_id` ORDER BY a.`sched_date` " . $sortType;
125
+ $orderBy = " ORDER BY filter.`sched_date` " . $sortType;
126
+ $addSearchBlogPostId = ((int) $this->searchBlogPostId != 0) ? " a.`post_id` = " . (int) $this->searchBlogPostId . " AND " : '';
127
+ $addSearchShowByDate = (!empty($this->searchShowByDate)) ? " (DATE_FORMAT(a.`publish_date`,'%Y-%m-%d') = '" . $this->searchShowByDate . "' OR DATE_FORMAT(a.`sched_date`,'%Y-%m-%d') = '" . $this->searchShowByDate . "') AND " : '';
128
+ $select = ' filter.`blog_user_id`, filter.`publish_date`, filter.`sched_date` ';
129
+ $selectInnerJoin = ' `sched_date` , `publish_date` ';
130
+ } else {
131
+ $addWhere = ($this->type == 'notice') ? ' AND a.`publish_error_code` != "" ' : ' AND a.`publish_error_code` = "" ';
132
+ $where = ($this->type == 'publish' || $this->type == 'notice') ? " a.`hide` = 0 AND a.`post_for_approve`= 0 AND (a.`sched_date`= '0000-00-00 00:00:00' OR a.`sched_type` = 3) $addWhere $addNotAdminPosts GROUP BY a.`post_id` ORDER BY a.`publish_date` " . $sortType : " a.`hide` = 0 AND ((a.`sched_date_utc` != '0000-00-00 00:00:00' AND a.`post_for_approve` = 0) OR (a.`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND a.`post_for_approve` = 1)) AND a.`sched_type` != 3 AND a.`publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts GROUP BY a.`post_id` ORDER BY a.`sched_date` " . $sortType;
133
+ $orderBy = ($this->type == 'publish' || $this->type == 'notice') ? " ORDER BY filter.`publish_date` " . $sortType : " ORDER BY filter.`sched_date` " . $sortType;
134
+ $addSearchBlogPostId = ((int) $this->searchBlogPostId != 0) ? " a.`post_id` = " . (int) $this->searchBlogPostId . " AND " : '';
135
+ $addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish' || $this->type == 'notice') ? " DATE_FORMAT(a.`publish_date`,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND " : " DATE_FORMAT(a.`sched_date`,'%Y-%m-%d') = '" . $this->searchShowByDate . "' AND ") : '';
136
+ $select = ($this->type == 'publish' || $this->type == 'notice') ? 'filter.`blog_user_id`, filter.`publish_date`' : 'filter.`blog_user_id`, filter.`sched_date`';
137
+ $selectInnerJoin = ($this->type == 'publish' || $this->type == 'notice') ? '`publish_date`' : '`sched_date`';
138
+ }
139
$addInnerJoinLeftJoin = ((int) $this->searchUserAuthId != 0) ? ' LEFT JOIN b2s_posts_network_details b ON b.`id` = a.`network_details_id` ' : '';
140
$addInnnerJoinLeftJoinWhere = ((int) $this->searchUserAuthId != 0) ? ' b.`network_auth_id` =' . $this->searchUserAuthId . ' AND ' : '';
141
142
$sqlPosts = "SELECT posts.`ID`, posts.`post_author`,posts.`post_type`,posts.`post_title`, " . $select . ", filter.`id`
143
FROM `$wpdb->posts` posts $leftJoin $leftJoin2
144
INNER JOIN(
152
153
$this->postData = $wpdb->get_results($sqlPosts);
154
155
+ if ($this->type == 'publish' || $this->type == 'notice' || $this->type == 'approve') {
156
$sqlPostsTotal = "SELECT COUNT(posts.`ID`)
157
FROM `$wpdb->posts` posts $leftJoin $leftJoin2
158
INNER JOIN(
163
ON posts.`ID` = filter.`post_id`
164
WHERE $addSearchType $addSearchAuthorId $addSearchPostTitle AND $postTypes $leftJoinWhere";
165
$this->postTotal = $wpdb->get_var($sqlPostsTotal);
166
//for Calender (mark Event)
167
} else {
168
+ $where = " a.`hide` = 0 AND a.`sched_type` != 3 AND ((a.`sched_date_utc` != '0000-00-00 00:00:00' AND a.`post_for_approve` = 0)OR (a.`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND a.`post_for_approve` = 1)) AND a.`publish_date`= '0000-00-00 00:00:00' $addNotAdminPosts ORDER BY a.`sched_date` " . $sortType;
169
$sqlPostsTotal = "SELECT posts.`ID`, DATE_FORMAT(filter.`sched_date`,'%Y-%m-%d') AS sched
170
FROM `$wpdb->posts` posts $leftJoin $leftJoin2
171
INNER JOIN(
175
) filter
176
ON posts.`ID` = filter.`post_id`
177
WHERE $addSearchType $addSearchAuthorId $addSearchPostTitle AND $postTypes $leftJoinWhere";
178
+
179
$schedResult = $wpdb->get_results($sqlPostsTotal);
180
if (is_array($schedResult) && !empty($schedResult)) {
181
$this->postCalendarSchedDates = array();
266
$userInfo = get_user_meta($var->blog_user_id);
267
$schedPublish = $this->getPostCount($var->ID);
268
$nextSched = $this->getLastPost($var->ID);
269
+
270
$this->postItem .= '<li class="list-group-item">
271
<div class="media">
272
<img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
285
</div>
286
</li>';
287
}
288
+
289
+ if ($this->type == 'approve') {
290
+ $userInfo = get_user_meta($var->blog_user_id);
291
+ $countApprove = $this->getPostCount($var->ID);
292
+ $this->postItem .= '<li class="list-group-item">
293
+ <div class="media">
294
+ <img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
295
+ <div class="media-body">
296
+ <div class="pull-left media-head">
297
+ <strong><a target="_blank" href="' . get_permalink($var->ID) . '">' . $postTitle . '</a></strong>
298
+ <span class="pull-right">
299
+ <button type="button" class="btn btn-primary btn-sm b2sDetailsApprovePostBtn" data-search-date="' . $this->searchShowByDate . '" data-post-id="' . $var->ID . '"><i class="glyphicon glyphicon-chevron-down"></i> ' . __('Details', 'blog2social') . '</button>
300
+ </span>
301
+ <p class="info hidden-xs"><a class="b2sDetailsApprovePostTriggerLink" href="#"><span class="b2s-approve-count" data-post-id="' . $var->ID . '">' . $countApprove . '</span> ' . __('social media posts ready to be shared', 'blog2social') . '</a></p>
302
+ </div>
303
+ <div class="pull-left">
304
+ <div class="b2s-post-approve-area" data-post-id="' . $var->ID . '"></div>
305
+ </div>
306
+ </div>
307
+ </div>
308
+ </li>';
309
+ }
310
}
311
312
return html_entity_decode($this->postItem, ENT_COMPAT, 'UTF-8');
316
if ($post_id > 0) {
317
global $wpdb;
318
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND posts.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
319
$addLeftJoin = ((int) $this->searchUserAuthId != 0) ? ' LEFT JOIN b2s_posts_network_details details ON details.`id` = posts.`network_details_id` ' : '';
320
$addLeftJoinWhere = ((int) $this->searchUserAuthId != 0) ? ' details.`network_auth_id` =' . $this->searchUserAuthId . ' AND ' : '';
321
+
322
+ if ($this->type == 'approve') {
323
+ $addSearchShowByDate = (!empty($this->searchShowByDate)) ? " (DATE_FORMAT(posts.publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' OR DATE_FORMAT(posts.sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "') AND " : '';
324
+ $where = ' posts.`post_for_approve` = 1 AND (posts.`publish_date` != "0000-00-00 00:00:00" OR posts.`sched_date_utc` <= "' . gmdate('Y-m-d H:i:s') . '")';
325
+ } else {
326
+ $addSearchShowByDate = (!empty($this->searchShowByDate)) ? (($this->type == 'publish' || $this->type == 'notice') ? " AND DATE_FORMAT(posts.publish_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' " : " AND DATE_FORMAT(posts.sched_date,'%Y-%m-%d') = '" . $this->searchShowByDate . "' ") : '';
327
+ $addWhere = ($this->type == 'notice') ? ' AND posts.`publish_error_code` != "" ' : ' AND posts.`publish_error_code` = "" ';
328
+ $where = ($this->type == 'publish' || $this->type == 'notice') ? " (posts.`sched_date` = '0000-00-00 00:00:00' OR posts.`sched_type` = 3) AND posts.`post_for_approve`= 0 " . $addWhere : " posts.`sched_type` != 3 AND posts.`publish_date` = '0000-00-00 00:00:00' AND ((posts.`sched_date_utc` != '0000-00-00 00:00:00' AND posts.`post_for_approve` = 0) OR (posts.`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND posts.`post_for_approve` = 1)) ";
329
+ }
330
+
331
$sqlPostsTotal = "SELECT COUNT(posts.`post_id`) FROM `b2s_posts` posts $addLeftJoin WHERE $addLeftJoinWhere $where $addNotAdmin $addSearchShowByDate AND posts.`hide` = 0 AND posts.`post_id` = " . $post_id;
332
return $wpdb->get_var($sqlPostsTotal);
333
}
340
$addNotAdmin = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
341
$order = ($this->type == 'publish' || $this->type == 'notice') ? " `publish_date` DESC" : " `sched_date` ASC ";
342
$addWhere = ($this->type == 'notice') ? ' AND `publish_error_code` != "" ' : ' AND `publish_error_code` = "" ';
343
+ $where = ($this->type == 'publish' || $this->type == 'notice') ? " `post_for_approve`= 0 AND (`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) " . $addWhere : " `sched_type` != 3 AND ((`sched_date_utc` != '0000-00-00 00:00:00' AND `post_for_approve` = 0) OR (`sched_date_utc` >= '" . gmdate('Y-m-d H:i:s') . "' AND `post_for_approve` = 1)) AND `publish_date` = '0000-00-00 00:00:00'";
344
$fields = ($this->type == 'publish' || $this->type == 'notice') ? "publish_date" : "sched_date";
345
$sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
346
return $wpdb->get_var($sqlLast);
355
$order = "`publish_date` DESC";
356
$where = "(`sched_date`= '0000-00-00 00:00:00' OR `sched_type` = 3) ";
357
$fields = "publish_date";
358
+ $sqlLast = "SELECT $fields FROM `b2s_posts` WHERE $where $addNotAdmin AND `hide` = 0 AND `post_for_approve`= 0 AND `post_id` = " . $post_id . " ORDER BY $order LIMIT 1";
359
$result = $wpdb->get_results($sqlLast);
360
if (!empty($result) && isset($result[0]->publish_date)) {
361
return $result[0]->publish_date;
408
$addNotAdminPosts = (!B2S_PLUGIN_ADMIN) ? (' AND blog_user_id =' . B2S_PLUGIN_BLOG_USER_ID) : '';
409
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`publish_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
410
$addWhere = ($type == 'notice') ? ' AND `b2s_posts`.`publish_error_code` != "" ' : ' AND `b2s_posts`.`publish_error_code` = "" ';
411
+ $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`.`post_for_approve`= 0 AND (`b2s_posts`.`sched_date` = '0000-00-00 00:00:00' OR `b2s_posts`.`sched_type` = 3) $addWhere $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`publish_date` DESC", $post_id);
412
$result = $wpdb->get_results($sqlData);
413
+ $specialPostingData = array(3 => __('Auto-Posting', 'blog2social'), 4 => __('Retweet', 'blog2social'));
414
if (!empty($result) && is_array($result)) {
415
$networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
416
$networkName = unserialize(B2S_PLUGIN_NETWORK);
452
<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 . $specialPosting . '</p>
453
<p class="info">' . $publishLink;
454
455
+ $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="#b2sPreFeatureModal" >';
456
+ $content .= __('delete from reporting', 'blog2social') . '</a> ';
457
458
if (!empty($error)) {
459
$content .= '| <a href="admin.php?page=blog2social-ship&postId=' . $post_id . '&network_auth_id=' . $var->network_auth_id . '">' . __('re-share', 'blog2social') . '</a>';
474
return false;
475
}
476
477
+ public function getApprovePostDataHtml($post_id = 0, $showByDate = '') {
478
+ if ($post_id > 0) {
479
+ global $wpdb;
480
+ $addNotAdminPosts = (!B2S_PLUGIN_ADMIN) ? (' AND blog_user_id =' . B2S_PLUGIN_BLOG_USER_ID) : '';
481
+ $addSearchShowByDate = (!empty($showByDate)) ? " AND (DATE_FORMAT(`b2s_posts`.`sched_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' OR DATE_FORMAT(`b2s_posts`.`publish_date`,'%%Y-%%m-%%d') = '" . $showByDate . "') " : '';
482
+ $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`, `b2s_posts`.`post_id`, `b2s_posts`.`blog_user_id`, `b2s_posts`.`sched_date`,`b2s_posts`.`publish_date`,`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`, `b2s_posts_sched_details`.`sched_data` FROM `b2s_posts` LEFT JOIN `b2s_posts_network_details` ON `b2s_posts`.`network_details_id` = `b2s_posts_network_details`.`id` LEFT JOIN `b2s_posts_sched_details` ON `b2s_posts`.`sched_details_id` = `b2s_posts_sched_details`.`id` WHERE `b2s_posts`.`hide` = 0 AND `b2s_posts`.`post_for_approve` = 1 AND (`b2s_posts`.`publish_date` != '0000-00-00 00:00:00' OR `b2s_posts`.`sched_date_utc` <= '" . gmdate('Y-m-d H:i:s') . "') $addNotAdminPosts $addSearchShowByDate AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`sched_date` ASC,`b2s_posts`.`publish_date` ASC", $post_id);
483
+ $result = $wpdb->get_results($sqlData);
484
+ if (!empty($result) && is_array($result)) {
485
+ $networkType = unserialize(B2S_PLUGIN_NETWORK_TYPE);
486
+ $networkName = unserialize(B2S_PLUGIN_NETWORK);
487
+ $content = '<div class="row"><div class="col-md-12"><ul class="list-group">';
488
+ $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>';
489
+ foreach ($result as $var) {
490
+ $approveDate = ($var->sched_date == "0000-00-00 00:00:00") ? B2S_Util::getCustomDateFormat($var->publish_date, substr(B2S_LANGUAGE, 0, 2)) : B2S_Util::getCustomDateFormat($var->sched_date, substr(B2S_LANGUAGE, 0, 2));
491
+ $approveText = __('is waiting to shared by', 'blog2social');
492
+ $userInfo = get_user_meta($var->blog_user_id);
493
+ $content .= ' <li class="list-group-item b2s-post-approve-area-li" data-post-id="' . $var->id . '">
494
+ <div class="media">';
495
+ $content .='<input class="checkboxes pull-left checkbox-item" data-blog-post-id="' . $post_id . '" name="selected-checkbox-item" value="' . $var->id . '" type="checkbox">';
496
+ $content .= '<img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype">';
497
+ $content .= '<div class="media-body">
498
+ <strong>' . $networkName[$var->network_id] . '</strong>
499
+ <p class="info">' . $networkType[$var->network_type] . (!empty($var->network_display_name) ? (': ' . $var->network_display_name) : '' ) . ' | ' . $approveText . ' <a href="' . get_author_posts_url($var->blog_user_id) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> ' . $approveDate . '</p>
500
+ <p class="info">';
501
+
502
+ $data = array(
503
+ 'token' => B2S_PLUGIN_TOKEN,
504
+ 'internal_post_id' => $var->id,
505
+ 'network_id' => $var->network_id,
506
+ 'network_auth_id' => $var->network_auth_id,
507
+ 'network_type' => $var->network_type
508
+ );
509
+
510
+ if ($var->sched_data != null && !empty($var->sched_data)) {
511
+ $schedData = unserialize($var->sched_data);
512
+ $data['post_format'] = isset($schedData['post_format']) ? (int) $schedData['post_format'] : 0;
513
+ $data['image_url'] = isset($schedData['image_url']) ? $schedData['image_url'] : "";
514
+ $data['content'] = isset($schedData['content']) ? $schedData['content'] : "";
515
+ $data['url'] = isset($schedData['url']) ? $schedData['url'] : "";
516
+ } else {
517
+ $postData = get_post($var->post_id);
518
+ $data['url'] = (get_permalink($postData->ID) !== false ? get_permalink($postData->ID) : $postData->guid);
519
+ }
520
+ $content .= ' <a href="#" class="btn btn-primary btn-xs" onclick="wopApprove(\'' . B2S_PLUGIN_API_ENDPOINT . 'instant/share.php?data=' . base64_encode(serialize($data)) . '\', \'Blog2Social\'); return false;" target="_blank">' . __('share', 'blog2social') . '</a>';
521
+
522
+ $content . '</p>
523
+ </div>
524
+ </div>
525
+ </li>';
526
+ }
527
+ $content .='<li class="list-group-item"><label class="checkbox-inline checkbox-all-label-btn"><span class="glyphicon glyphicon glyphicon-trash "></span> ';
528
+ $content .= B2S_PLUGIN_USER_VERSION > 0 ? '<a class="checkbox-post-approve-all-btn" data-blog-post-id="' . $post_id . '" href="#">' : '<a href="#" data-toggle="modal" data-title="' . __('You want to delete your Social Media post?', 'blog2social') . '" data-target="#b2sPreFeatureModal" >';
529
+ $content .= __('delete', 'blog2social') . '</a></label></li>';
530
+ $content .= '</ul></div></div>';
531
+ return $content;
532
+ }
533
+ }
534
+ return false;
535
+ }
536
+
537
public function getSchedPostDataHtml($post_id = 0, $showByDate = '', $userAuthId = 0) {
538
if ($post_id > 0) {
539
global $wpdb;
540
$addNotAdminPosts = (B2S_PLUGIN_ADMIN == false) ? $wpdb->prepare(' AND `b2s_posts`.`blog_user_id` = %d', B2S_PLUGIN_BLOG_USER_ID) : '';
541
$addSearchShowByDate = (!empty($showByDate)) ? " AND DATE_FORMAT(`b2s_posts`.`sched_date`,'%%Y-%%m-%%d') = '" . $showByDate . "' " : '';
542
$addSearchUserAuthId = ($userAuthId != 0) ? " AND `b2s_posts_network_details`.`network_auth_id` =" . $userAuthId . " " : '';
543
+ $sqlData = $wpdb->prepare("SELECT `b2s_posts`.`id`, `b2s_posts`.`post_id`,`blog_user_id`,`v2_id`, `sched_date`,`sched_type`, `relay_primary_post_id`, `b2s_posts_network_details`.`network_id`,`b2s_posts_network_details`.`network_auth_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_date_utc` != '0000-00-00 00:00:00' AND `b2s_posts`.`post_for_approve` = 0) OR (`b2s_posts`.`sched_date_utc` >= '".gmdate('Y-m-d H:i:s')."' AND `b2s_posts`.`post_for_approve` = 1)) AND `b2s_posts`.`sched_type` != 3 AND `b2s_posts`.`publish_date` = '0000-00-00 00:00:00' $addNotAdminPosts $addSearchShowByDate $addSearchUserAuthId AND `b2s_posts`.`post_id` = %d ORDER BY `b2s_posts`.`sched_date` ASC ", $post_id);
544
$result = $wpdb->get_results($sqlData);
545
$specialPostingData = array(4 => __('Retweet', 'blog2social'));
546
if (!empty($result) && is_array($result)) {
559
$content .='<img class="pull-left hidden-xs" src="' . plugins_url('/assets/images/portale/' . $var->network_id . '_flat.png', B2S_PLUGIN_FILE) . '" alt="posttype">
560
<div class="media-body">
561
<strong>' . $networkName[$var->network_id] . '</strong>
562
+ <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> ' . $specialPosting . '</p>
563
<p class="info">';
564
565
if ((int) $var->v2_id == 0) {
566
//data-blog-sched-date="' . $blogPostDate . '" data-b2s-sched-date="' . strtotime($var->sched_date) . '000"
567
+ $content .= (B2S_PLUGIN_USER_VERSION > 0) ? ' <a href="#" class="b2s-post-edit-sched-btn" data-network-auth-id="' . $var->network_auth_id . '" data-network-type="' . $var->network_type . '" data-network-id="' . $var->network_id . '" data-post-id="' . $var->post_id . '" data-b2s-id="' . $var->id . '" data-relay-primary-post-id="' . $var->relay_primary_post_id . '" >' : ' <a href="#" data-toggle="modal" data-title="' . __('You want to edit your scheduled post?', 'blog2social') . '" data-target="#b2sPreFeatureModal">';
568
$content .= __('edit', 'blog2social') . '</a> ';
569
$content .= '|';
570
}
includes/B2S/Post/Tools.php CHANGED
@@ -24,10 +24,14 @@ class B2S_Post_Tools {
24
$blogPostId = 0;
25
26
foreach ($postIds as $v) {
27
- $sql = $wpdb->prepare("SELECT id,post_id,post_for_relay FROM b2s_posts WHERE id =%d AND publish_date = %s", (int) $v, "0000-00-00 00:00:00");
28
$row = $wpdb->get_row($sql);
29
if (isset($row->id) && (int) $row->id == $v) {
30
- $wpdb->update('b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $v));
31
$resultPostIds[] = $v;
32
$blogPostId = $row->post_id;
33
@@ -37,7 +41,7 @@ class B2S_Post_Tools {
37
if (is_array($res) && !empty($res)) {
38
foreach ($res as $item) {
39
if (isset($item->id) && (int) $item->id > 0) {
40
- $wpdb->update('b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' =>$item->id));
41
$resultPostIds[] = $item->id;
42
}
43
}
@@ -81,4 +85,26 @@ class B2S_Post_Tools {
81
return array('result' => false);
82
}
83
84
}
24
$blogPostId = 0;
25
26
foreach ($postIds as $v) {
27
+ $sql = $wpdb->prepare("SELECT id,post_id,post_for_relay,post_for_approve FROM b2s_posts WHERE id =%d AND publish_date = %s", (int) $v, "0000-00-00 00:00:00");
28
$row = $wpdb->get_row($sql);
29
if (isset($row->id) && (int) $row->id == $v) {
30
+ if ((int)$row->post_for_approve == 1) {
31
+ $wpdb->update('b2s_posts', array('hide' => 1), array('id' => $v));
32
+ } else {
33
+ $wpdb->update('b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $v));
34
+ }
35
$resultPostIds[] = $v;
36
$blogPostId = $row->post_id;
37
41
if (is_array($res) && !empty($res)) {
42
foreach ($res as $item) {
43
if (isset($item->id) && (int) $item->id > 0) {
44
+ $wpdb->update('b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
45
$resultPostIds[] = $item->id;
46
}
47
}
85
return array('result' => false);
86
}
87
88
+ public static function deleteUserApprovePost($postIds = array()) {
89
+ global $wpdb;
90
+ $resultPostIds = array();
91
+ $blogPostId = 0;
92
+ $count = 0;
93
+ foreach ($postIds as $v) {
94
+ $sql = $wpdb->prepare("SELECT id,v2_id,post_id FROM b2s_posts WHERE id =%d", (int) $v);
95
+ $row = $wpdb->get_row($sql);
96
+ if (isset($row->id) && (int) $row->id == $v) {
97
+ $hook_action = (isset($row->v2_id) && (int) $row->v2_id > 0) ? 0 : 4; //oldItems
98
+ $wpdb->update('b2s_posts', array('hide' => 1), array('id' => $v));
99
+ $resultPostIds[] = $v;
100
+ $blogPostId = $row->post_id;
101
+ $count++;
102
+ }
103
+ }
104
+ if (!empty($resultPostIds) && is_array($resultPostIds)) {
105
+ return array('result' => true, 'postId' => $resultPostIds, 'postCount' => $count, 'blogPostId' => $blogPostId);
106
+ }
107
+ return array('result' => false);
108
+ }
109
+
110
}
includes/B2S/PostBox.php CHANGED
@@ -14,7 +14,7 @@ class B2S_PostBox {
14
15
$isChecked = "";
16
$lastPost = "";
17
-
18
//Unlock Auto-Post-Import
19
delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . B2S_PLUGIN_BLOG_USER_ID);
20
@@ -99,6 +99,7 @@ class B2S_PostBox {
99
<h3 class="b2s-meta-box-headline">' . __('Custom Sharing & Scheduling', 'blog2social') . ' <a class="b2s-info-btn" data-modal-target="b2sInfoMetaBoxModalSched" href="#">' . __('Info', 'blog2social') . '</a></h3>
100
<a id="b2s-meta-box-btn-customize" 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>
101
<hr>
102
<h3 class="b2s-meta-box-headline">' . __('Social Media Auto-Posting', 'blog2social') . ' <a class="b2s-info-btn" data-modal-target="b2sInfoMetaBoxModalAutoPost" href="#">' . __('Info', 'blog2social') . '</a></h3>
103
' . $lastPost;
104
14
15
$isChecked = "";
16
$lastPost = "";
17
+
18
//Unlock Auto-Post-Import
19
delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . B2S_PLUGIN_BLOG_USER_ID);
20
99
<h3 class="b2s-meta-box-headline">' . __('Custom Sharing & Scheduling', 'blog2social') . ' <a class="b2s-info-btn" data-modal-target="b2sInfoMetaBoxModalSched" href="#">' . __('Info', 'blog2social') . '</a></h3>
100
<a id="b2s-meta-box-btn-customize" 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>
101
<hr>
102
+ <div class="b2s-info-warning" style="display:block;"><b>'.__('Facebook Instant Sharing:','blog2social').'</b><br>' . __('Auto-posts for Facebook Profiles will be shown in the "Instant Sharing" tab on your "Posts & Sharing" navigation bar and can be shared on your Facebook Profile by clicking on the "Share" button next to your auto-post.', 'blog2social') . '</div>
103
<h3 class="b2s-meta-box-headline">' . __('Social Media Auto-Posting', 'blog2social') . ' <a class="b2s-info-btn" data-modal-target="b2sInfoMetaBoxModalAutoPost" href="#">' . __('Info', 'blog2social') . '</a></h3>
104
' . $lastPost;
105
includes/B2S/Settings/Item.php CHANGED
@@ -78,7 +78,7 @@ class B2S_Settings_Item {
78
$isChecked = (isset($this->settings->short_url) && (int) $this->settings->short_url == 0) ? 1 : 0;
79
$isCheckedAllowHashTag = ($optionUserHashTag === false || $optionUserHashTag == 1) ? 1 : 0; //default allow , 1=include 0=not include
80
$isShortenerBitlyActive = (isset($this->settings->shortener_bitly_display_name) && !empty($this->settings->shortener_bitly_display_name)) ? true : false;
81
- $isChecked = ($isShortenerBitlyActive) ? 0: 1;
82
83
$content = '';
84
$content .='<h4>' . __('Account', 'blog2social') . '</h4>';
@@ -99,7 +99,7 @@ class B2S_Settings_Item {
99
$content .='<strong>' . __('Url Shortener', 'blog2social') . '</strong> <a href="#" data-toggle="modal" data-target="#b2sInfoUrlShortenerModal" class="b2s-info-btn del-padding-left">' . __('Info', 'Blog2Social') . '</a><br>';
100
$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"> <img class="b2s-shortener-image" alt="Bitly" src="' . plugins_url('/assets/images/settings/bitly.png', B2S_PLUGIN_FILE) . '"> ' . __('Bitly', 'blog2social') . '</label>';
101
$content .=' <span class="b2s-user-network-shortener-account-area" data-provider-id="0">';
102
- $content .='<input type="hidden" id="b2s-user-network-shortener-state" data-provider-id="0" value="'.(($isShortenerBitlyActive) ? 1: 0).'"/>';
103
$content .='<span class="b2s-user-network-shortener-connect" data-provider-id="0" style="display:' . ((!$isShortenerBitlyActive) ? 'inline-block' : 'none') . ';" ><a href="#" class="b2s-shortener-account-connect-btn" data-provider-id="0" onclick="wopShortener(\'' . $this->authUrl . '&provider_id=0\', \'Blog2Social Network\'); return false;">' . __('connect', 'blog2social') . '</a> </span>';
104
$content .='<span class="b2s-user-network-shortener-account-detail" data-provider-id="0" style="display:' . (($isShortenerBitlyActive) ? 'inline-block' : 'none') . ';">(' . __('Account', 'blog2social') . ': <span id="b2s-shortener-account-display-name" data-provider-id="0">' . (($isShortenerBitlyActive) ? $this->settings->shortener_bitly_display_name : '') . '</span> <a href="#" class="b2s-shortener-account-change-btn" data-provider-id="0" onclick="wopShortener(\'' . $this->authUrl . '&provider_id=0\', \'Blog2Social Network\'); return false;">' . __('change', 'blog2social') . '</a> | <a href="#" class="b2s-shortener-account-delete-btn" data-provider-id="0">' . __('delete', 'blog2social') . '</a>)</span>';
105
$content .='</span>';
@@ -139,6 +139,8 @@ class B2S_Settings_Item {
139
$limit = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
140
141
$content = '';
142
$content .='<h4>' . __('Auto-post your own created posts', 'blog2social') . ' ' . $isPremium . ' <a href="#" data-toggle="modal" data-target="#b2sInfoAutoShareModal" class="b2s-info-btn del-padding-left">' . __('Info', 'Blog2Social') . '</a>';
143
$content .='<br><div class="b2s-text-sm">' . __('Define by default to automatically post your posts on social media:', 'blog2social') . '</div>';
144
$content .='</h4>';
@@ -183,9 +185,16 @@ class B2S_Settings_Item {
183
$content .='<br><div class="b2s-text-sm">' . __('Define by default to automatically share your imported posts to social media:', 'blog2social') . '</div>';
184
$content .='</h4>';
185
186
- $content .='<p>' . __('Your current licence:', 'blog2social');
187
- $content .='<span class="b2s-key-name"> ' . $versionType[B2S_PLUGIN_USER_VERSION] . '</span> (' . __('share up to', 'blog2social') . ' ' . $limit[B2S_PLUGIN_USER_VERSION] . ' ' . __('posts per day', 'blog2social') . ') ';
188
- $content .='<a class="b2s-info-btn" href="' . B2S_Tools::getSupportLink('affiliate') . '" target="_blank">' . __('need more?', 'blog2social') . '</a></p>';
189
$content .='<br>';
190
$content .='<p class="b2s-bold">' . __('Select by default to automatically share your imported posts', 'blog2social') . '</p>';
191
$content .= '<form id="b2s-user-network-settings-auto-post-imported-own" method = "post" ' . (!empty($isPremium) ? 'class="b2s-btn-disabled"' : '') . ' >';
78
$isChecked = (isset($this->settings->short_url) && (int) $this->settings->short_url == 0) ? 1 : 0;
79
$isCheckedAllowHashTag = ($optionUserHashTag === false || $optionUserHashTag == 1) ? 1 : 0; //default allow , 1=include 0=not include
80
$isShortenerBitlyActive = (isset($this->settings->shortener_bitly_display_name) && !empty($this->settings->shortener_bitly_display_name)) ? true : false;
81
+ $isChecked = ($isShortenerBitlyActive) ? 0 : 1;
82
83
$content = '';
84
$content .='<h4>' . __('Account', 'blog2social') . '</h4>';
99
$content .='<strong>' . __('Url Shortener', 'blog2social') . '</strong> <a href="#" data-toggle="modal" data-target="#b2sInfoUrlShortenerModal" class="b2s-info-btn del-padding-left">' . __('Info', 'Blog2Social') . '</a><br>';
100
$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"> <img class="b2s-shortener-image" alt="Bitly" src="' . plugins_url('/assets/images/settings/bitly.png', B2S_PLUGIN_FILE) . '"> ' . __('Bitly', 'blog2social') . '</label>';
101
$content .=' <span class="b2s-user-network-shortener-account-area" data-provider-id="0">';
102
+ $content .='<input type="hidden" id="b2s-user-network-shortener-state" data-provider-id="0" value="' . (($isShortenerBitlyActive) ? 1 : 0) . '"/>';
103
$content .='<span class="b2s-user-network-shortener-connect" data-provider-id="0" style="display:' . ((!$isShortenerBitlyActive) ? 'inline-block' : 'none') . ';" ><a href="#" class="b2s-shortener-account-connect-btn" data-provider-id="0" onclick="wopShortener(\'' . $this->authUrl . '&provider_id=0\', \'Blog2Social Network\'); return false;">' . __('connect', 'blog2social') . '</a> </span>';
104
$content .='<span class="b2s-user-network-shortener-account-detail" data-provider-id="0" style="display:' . (($isShortenerBitlyActive) ? 'inline-block' : 'none') . ';">(' . __('Account', 'blog2social') . ': <span id="b2s-shortener-account-display-name" data-provider-id="0">' . (($isShortenerBitlyActive) ? $this->settings->shortener_bitly_display_name : '') . '</span> <a href="#" class="b2s-shortener-account-change-btn" data-provider-id="0" onclick="wopShortener(\'' . $this->authUrl . '&provider_id=0\', \'Blog2Social Network\'); return false;">' . __('change', 'blog2social') . '</a> | <a href="#" class="b2s-shortener-account-delete-btn" data-provider-id="0">' . __('delete', 'blog2social') . '</a>)</span>';
105
$content .='</span>';
139
$limit = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
140
141
$content = '';
142
+ $content .='<div class="panel panel-group b2s-auto-post-own-update-warning"><div class="panel-body"><span class="glyphicon glyphicon-exclamation-sign glyphicon-warning"></span> ' . __('Auto-posts for Facebook Profiles will be shown in the "Instant Sharing" tab on your "Posts & Sharing" navigation bar and can be shared on your Facebook Profile by clicking on the "Share" button next to your auto-post.', 'blog2social') . '</div>';
143
+ $content .='</div>';
144
$content .='<h4>' . __('Auto-post your own created posts', 'blog2social') . ' ' . $isPremium . ' <a href="#" data-toggle="modal" data-target="#b2sInfoAutoShareModal" class="b2s-info-btn del-padding-left">' . __('Info', 'Blog2Social') . '</a>';
145
$content .='<br><div class="b2s-text-sm">' . __('Define by default to automatically post your posts on social media:', 'blog2social') . '</div>';
146
$content .='</h4>';
185
$content .='<br><div class="b2s-text-sm">' . __('Define by default to automatically share your imported posts to social media:', 'blog2social') . '</div>';
186
$content .='</h4>';
187
188
+ $content .='<p>' . __('Your current licence:', 'blog2social') . '<span class="b2s-key-name"> ' . $versionType[B2S_PLUGIN_USER_VERSION] . '</span>';
189
+ if (B2S_PLUGIN_USER_VERSION == 0) {
190
+ $content .='<br>' . __('Immediate Cross-Posting across all networks: Share an unlimited number of posts', 'blog2social') . '<br>';
191
+ $content .=__('Scheduled Auto-Posting', 'blog2social') . ': <a class="b2s-info-btn" href="' . B2S_Tools::getSupportLink('affiliate') . '" target="_blank">' . __('Upgrade', 'blog2social') . '</a>';
192
+ } else {
193
+ $content .='(' . __('share up to', 'blog2social') . ' ' . $limit[B2S_PLUGIN_USER_VERSION] . ' ' . __('posts per day', 'blog2social') . ') ';
194
+ $content .='<a class="b2s-info-btn" href="' . B2S_Tools::getSupportLink('affiliate') . '" target="_blank">' . __('Upgrade', 'blog2social') . '</a>';
195
+ }
196
+ $content .='</p>';
197
+
198
$content .='<br>';
199
$content .='<p class="b2s-bold">' . __('Select by default to automatically share your imported posts', 'blog2social') . '</p>';
200
$content .= '<form id="b2s-user-network-settings-auto-post-imported-own" method = "post" ' . (!empty($isPremium) ? 'class="b2s-btn-disabled"' : '') . ' >';
includes/B2S/Ship/Item.php CHANGED
@@ -45,7 +45,7 @@ class B2S_Ship_Item {
45
private $maxMonthTimeSelect = 12;
46
private $maxTimeSelect = 50;
47
private $maxSchedCount = 3;
48
- //private $maxReplayCount = 3;
49
private $setRelayCount = 0;
50
private $maxDaySelect = 31;
51
private $noScheduleRegularly = array(2, 4, 11, 14, 15, 18);
@@ -84,16 +84,17 @@ class B2S_Ship_Item {
84
$contentTwitter = $userOptions->_getOption('content_network_twitter');
85
$networkName = unserialize(B2S_PLUGIN_NETWORK);
86
$networkTypeName = unserialize(B2S_PLUGIN_NETWORK_TYPE);
87
$limit = false;
88
$limitValue = 0;
89
$textareaLimitInfo = "";
90
$textareaOnKeyUp = "";
91
$this->defaultImage = plugins_url('/assets/images/no-image.png', B2S_PLUGIN_FILE);
92
93
- //Settings
94
switch ($data->networkType) {
95
case '0':
96
- //profil
97
if (isset($this->limitCharacterProfile[$data->networkId]) && (int) $this->limitCharacterProfile[$data->networkId] > 0) {
98
$limitValue = $this->limitCharacterProfile[$data->networkId];
99
$limit = true;
@@ -107,9 +108,9 @@ class B2S_Ship_Item {
107
$network_display_name = $data->network_display_name;
108
$isRequiredTextarea = (in_array($data->networkId, $this->isCommentProfile)) ? '' : 'required="required"';
109
110
- //ShortText
111
if (isset($this->setShortTextProfile[$data->networkId]) && (int) $this->setShortTextProfile[$data->networkId] > 0) {
112
- //$preContent = ($data->networkId == 2) ? B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang);
113
if ($data->networkId == 2) {
114
$preContent = B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang);
115
if ($contentTwitter !== false && $contentTwitter == 1 && B2S_PLUGIN_USER_VERSION >= 1) {
@@ -126,7 +127,7 @@ class B2S_Ship_Item {
126
$message = (in_array($data->networkId, $this->allowTitleProfile) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : 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), $this->userLang));
127
}
128
129
- //Feature Image Html-Network
130
if (in_array($data->networkId, $this->allowHtml)) {
131
$featuredImage = wp_get_attachment_url(get_post_thumbnail_id($this->postId));
132
if ($featuredImage !== false) {
@@ -135,7 +136,7 @@ class B2S_Ship_Item {
135
}
136
}
137
138
- //Hashtags
139
if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
140
$add = ($data->networkId != 2) ? "\n\n" : "";
141
$message .= $this->getHashTagsString($add);
@@ -155,7 +156,7 @@ class B2S_Ship_Item {
155
156
break;
157
case '1':
158
- //page
159
if (isset($this->limitCharacterPage[$data->networkId]) && (int) $this->limitCharacterPage[$data->networkId] > 0) {
160
$limitValue = $this->limitCharacterPage[$data->networkId];
161
$limit = true;
@@ -163,7 +164,7 @@ class B2S_Ship_Item {
163
$infoImage = (in_array($data->networkId, $this->allowNoImagePage)) ? __('Network does not support image for pages', 'blog2social') . '!' : '';
164
$infoImage .= (in_array($data->networkId, $this->allowNoEmoji)) ? (!empty($infoImage) ? ' | ' : '') . __('Network does not support emojis', 'blog2social') . '!' : '';
165
166
- //ShortText
167
if (isset($this->setShortTextPage[$data->networkId]) && (int) $this->setShortTextPage[$data->networkId] > 0) {
168
if ($data->networkId == 8) { //Xing -1 Leerzeichen
169
$this->setShortTextPage[$data->networkId] = (int) $this->setShortTextPage[$data->networkId] - mb_strlen($this->postUrl, 'UTF-8') - 1;
@@ -173,7 +174,7 @@ class B2S_Ship_Item {
173
$message = (in_array($data->networkId, $this->allowTitlePage) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : 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), $this->userLang));
174
}
175
176
- //Hashtags
177
if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
178
$message .= $this->getHashTagsString();
179
}
@@ -193,14 +194,14 @@ class B2S_Ship_Item {
193
}
194
break;
195
case'2':
196
- //group
197
- //ShortText
198
if (isset($this->setShortTextGroup[$data->networkId]) && (int) $this->setShortTextGroup[$data->networkId] > 0) {
199
$message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang), (isset($this->setShortTextGroup[$data->networkId]) ? (int) $this->setShortTextGroup[$data->networkId] : false), (isset($this->setShortTextGroupLimit[$data->networkId]) ? (int) $this->setShortTextGroupLimit[$data->networkId] : false));
200
} else {
201
$message = (in_array($data->networkId, $this->allowTitleGroup) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : 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), $this->userLang));
202
}
203
- //Hashtags
204
if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
205
$message .= $this->getHashTagsString();
206
}
@@ -221,12 +222,12 @@ class B2S_Ship_Item {
221
}
222
223
224
- //Infotexte
225
$messageInfo = (!empty($infoImage)) ? '<p class="b2s-post-item-message-info pull-left hidden-sm hidden-xs">' . $infoImage . '</p>' : '';
226
$onlyimage = in_array($data->networkId, $this->onlyImage) ? 'b2sOnlyWithImage' : '';
227
228
$content = '<div class="b2s-post-item ' . $onlyimage . '" data-network-auth-id="' . $data->networkAuthId . '" data-network-id="' . $data->networkId . '">';
229
- $content .= '<div class="panel panel-group">';
230
$content .= '<div class="panel-body ' . ((isset($this->viewMode) && $this->viewMode == 'modal') ? 'del-padding-left del-padding-right' : '') . ' ">';
231
$content .= '<div class="b2s-post-item-area" data-network-auth-id="' . $data->networkAuthId . '">';
232
$content .= '<div class="b2s-post-item-thumb hidden-xs">';
@@ -261,12 +262,19 @@ class B2S_Ship_Item {
261
262
$content .= '</p>';
263
264
- //TOS Twitter 032018
265
if (in_array($data->networkId, $this->networkTos)) {
266
$content .='';
267
$content .='<div class="b2s-unique-content" data-network-auth-id="' . $data->networkAuthId . '"><div class="clearfix"></div><div class="alert b2s-unique-content-alert alert-danger">' . __('Please keep in mind that according to Twitter’s new TOS, users are no longer allowed to post identical or substantially similar content to multiple accounts or multiple duplicate updates on one account.', 'blog2social') . '<br><strong>' . __('Violating these rules can result in Twitter suspending your account. Always vary your Tweets with different comments, hashtags or handles to prevent duplicate posts.', 'blog2social') . '</strong> <a href="' . B2S_Tools::getSupportLink('network_tos_blog_032018') . '" target="_blank">' . __('Learn more about this', 'blog2social') . '</a></div></div>';
268
}
269
270
$content .= '<div class="b2s-post-item-details-edit-area" data-network-auth-id="' . $data->networkAuthId . '">';
271