Blog2Social: Social Media Auto Post & Scheduler - Version 5.1.0

Version Description

Usability Optimization, new content seeding plan

Download this release

Release Info

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

Code changes from version 5.0.4 to 5.1.0

assets/css/b2s/network.css CHANGED
@@ -31,27 +31,72 @@
31
}
32
.b2s-network-auth-btn{
33
margin-left: 2px;
34
}
35
36
.b2s-network-get-more-btn{
37
text-decoration: underline;
38
}
39
.b2s-network-auth-count{
40
font-size: 12px;
41
- font-style: italic;
42
- color: #777;
43
- font-weight: normal;
44
- line-height: 1;
45
}
46
47
- .not-allow{
48
- color: #777 !important;
49
- text-decoration: line-through;
50
}
51
52
- .no-allow-info-text{
53
- font-style: italic;
54
- margin-bottom: 10px;
55
}
56
57
.b2s-network-mandant-select{
@@ -68,7 +113,19 @@
68
69
.b2s-network-item-auth-list{
70
padding-top:6px;
71
- font-size: 0.87rem !important;
72
}
73
74
.b2s-network-item-auth-list-li{
@@ -83,11 +140,74 @@ ul.b2s-network-item-auth-list li:last-child{
83
border-bottom: 1px solid rgba(0,0,0,.1) !important;
84
}
85
86
-
87
.b2s-network-item-auth-type{
88
font-weight: 600;
89
}
90
91
.b2s-modify-board-and-group-network-modal-footer{
92
border: 0px !important;
93
}
31
}
32
.b2s-network-auth-btn{
33
margin-left: 2px;
34
+ line-height: 2;
35
+ }
36
+
37
+ .b2s-network-item-auth-list-btn-delete{
38
+ line-height: 2;
39
}
40
41
.b2s-network-get-more-btn{
42
text-decoration: underline;
43
}
44
.b2s-network-auth-count{
45
+ font-weight: 700;
46
+ line-height: 1.5;
47
+ }
48
+
49
+ .b2s-sched-manager-title{
50
+ font-weight: 700;
51
+ line-height: 1.5;
52
+ padding-right: 165px;
53
+ }
54
+
55
+ .b2s-sched-manager-time-area{
56
+ width: 150px;
57
+ margin-right: -35px;
58
+ }
59
+
60
+ .b2s-sched-manager-add-padding{
61
+ margin-right: -13px;
62
+ }
63
+
64
+ .b2s-add-padding-network-refresh{
65
+ padding: 4px 15px;
66
+ }
67
+
68
+ .b2s-sched-manager-best-time-info{
69
+ padding-left: 15px;
70
font-size: 12px;
71
}
72
73
+ .b2s-network-time-manager-area{
74
+ padding-right: 8px;
75
}
76
77
+ .b2s-add-padding-network-edit{
78
+ padding: 7px 4px;
79
+ }
80
+ .b2s-network-mandant-area{
81
+ margin-top: -7px !important;
82
+ }
83
+
84
+ .b2s-add-padding-network-delete{
85
+ padding: 4px 5px;
86
+ }
87
+
88
+ .b2s-sched-manager-day-area{
89
+ width: 150px;
90
+ padding-top: 2px;
91
+ }
92
+
93
+ .b2s-sched-manager-premium-area{
94
+ width: 195px;
95
+ padding-top: 5px;
96
+ }
97
+
98
+ .b2s-settings-sched-item-input-time, .b2s-settings-sched-item-input-day{
99
+ max-width: 90px;
100
}
101
102
.b2s-network-mandant-select{
113
114
.b2s-network-item-auth-list{
115
padding-top:6px;
116
+ font-size: 0.80rem !important;
117
+ }
118
+
119
+ .b2s-network-auth-list-info{
120
+ font-weight: 700;
121
+ }
122
+
123
+ .b2s-network-auth-list-info a {
124
+ text-decoration: underline;
125
+ }
126
+
127
+ .glyphicon-white{
128
+ color:#FFFFFF;
129
}
130
131
.b2s-network-item-auth-list-li{
140
border-bottom: 1px solid rgba(0,0,0,.1) !important;
141
}
142
143
.b2s-network-item-auth-type{
144
font-weight: 600;
145
+ line-height: 2;
146
}
147
148
.b2s-modify-board-and-group-network-modal-footer{
149
border: 0px !important;
150
+ }
151
+
152
+ .b2s-sched-manager-item-input-day {
153
+ color: #32373c;
154
+ display: inline-block;
155
+ vertical-align: middle;
156
+ font: 18px/1 Arial,sans-serif;
157
+ font-weight: 700;
158
+ line-height: 30px;
159
+ padding: 0 2px
160
+ ;min-width: 28px;
161
+ text-align: center;
162
+ border: 0 !important;
163
+ width: 2% !important;
164
+ -webkit-appearance: none !important;
165
+ box-shadow: inset 0px 0px 0px rgba(0,0,0,0) !important;
166
+ margin: 0 !important;
167
+ background-color:white !important;
168
+ }
169
+ .b2s-sched-manager-item-input-day-btn-plus {
170
+ cursor: pointer;
171
+ display: inline-block;
172
+ vertical-align: middle;
173
+ width: 24px;
174
+ height: 24px;
175
+ font: 23px/1 Arial,sans-serif;
176
+ text-align: center;
177
+ border-radius: 50%;
178
+ background-color: #eee;
179
+ border: 1px solid #ddd;
180
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
181
+ color: #32373c
182
+ }
183
+ .b2s-sched-manager-item-input-day-btn-minus {
184
+ cursor: pointer;
185
+ display: inline-block;
186
+ vertical-align: middle;
187
+ width: 24px;
188
+ height: 24px;
189
+ font: 21px/1 Arial,sans-serif;
190
+ text-align: center;
191
+ border-radius: 50%;
192
+ background-clip: padding-box;
193
+ background-color: #eee;
194
+ border: 1px solid #ddd;
195
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
196
+ color: #32373c
197
+ }
198
+ .b2s-text-middle{
199
+ vertical-align: middle;
200
+ font: 13px/1 Arial,sans-serif;
201
+ }
202
+
203
+ .b2s-label-warning-border-left{
204
+ border-left: 3px solid #FDBF45;
205
+ }
206
+
207
+ .b2s-label-danger-border-left{
208
+ border-left: 3px solid #d9534f;
209
+ }
210
+
211
+ .b2s-label-success-border-left{
212
+ border-left: 3px solid #398439;
213
}
assets/css/b2s/settings.css CHANGED
@@ -12,23 +12,6 @@
12
border: 1px solid #FF0000 !important;
13
}
14
15
- .b2s-box-sched-time-input{
16
- width: 90px !important;
17
- }
18
- .b2s-box-sched-time-area{
19
- margin-left: 100px;
20
- }
21
- .b2s-box-sched-time-area-label{
22
- font-size: 12px;
23
- margin-bottom: 1px !important;
24
- font-weight: 600;
25
- }
26
- .b2s-settings-sched-time-info, .b2s-settings-time-zone-info{
27
- margin-top: 30px;
28
- font-size: 13px;
29
- font-style:italic;
30
- }
31
-
32
.nav > li > a{
33
padding: 10px 15px !important;
34
}
12
border: 1px solid #FF0000 !important;
13
}
14
15
.nav > li > a{
16
padding: 10px 15px !important;
17
}
assets/images/prg/product-icon.png ADDED
Binary file
assets/js/b2s/network.js CHANGED
@@ -1,6 +1,9 @@
1
jQuery.noConflict();
2
3
jQuery(window).on("load", function () {
4
if (jQuery('.b2s-network-mandant-select').val() == 0 || jQuery('.b2s-network-mandant-select').val() == -1) {
5
jQuery('.b2s-network-mandant-btn-delete').hide();
6
} else {
@@ -10,12 +13,93 @@ jQuery(window).on("load", function () {
10
jQuery('.b2s-network-details-container-list[data-mandant-id="' + jQuery('.b2s-network-mandant-select').val() + '"]').show();
11
12
jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
13
- jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length);
14
});
15
16
17
});
18
19
jQuery(document).on('change', '.b2s-network-mandant-select', function () {
20
jQuery('.b2s-network-auth-info').hide();
21
if (jQuery(this).val() == 0 || jQuery(this).val() == -1) {
@@ -180,7 +264,15 @@ jQuery(document).on('click', '.b2s-modify-board-and-group-network-save-btn', fun
180
});
181
182
183
-
184
185
jQuery(document).on('click', '.b2s-network-item-auth-list-btn-delete', function () {
186
jQuery('.b2s-loading-area').show();
@@ -188,6 +280,7 @@ jQuery(document).on('click', '.b2s-network-item-auth-list-btn-delete', function
188
jQuery('#b2s-network-delete-auth').modal('show');
189
jQuery('#b2s-delete-network-auth-id').val(jQuery(this).attr('data-network-auth-id'));
190
jQuery('#b2s-delete-network-id').val(jQuery(this).attr('data-network-id'));
191
jQuery('.b2s-server-connection-fail').hide();
192
jQuery('.b2s-btn-network-delete-auth-show-post-text').hide();
193
jQuery('.b2s-btn-network-delete-auth-show-post-btn').hide();
@@ -213,10 +306,13 @@ jQuery(document).on('click', '.b2s-network-item-auth-list-btn-delete', function
213
jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
214
jQuery('.b2s-btn-network-delete-auth-show-post-btn').show();
215
jQuery('#b2s-btn-network-delete-auth-show-post-count').text(data.count);
216
} else {
217
- jQuery('.b2s-btn-network-delete-auth-confirm-text').show();
218
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').show();
219
}
220
}
221
});
222
return false;
@@ -240,7 +336,9 @@ jQuery(document).on('click', '.b2s-btn-network-delete-auth-confirm-btn', functio
240
data: {
241
'action': 'b2s_delete_user_auth',
242
'networkAuthId': jQuery('#b2s-delete-network-auth-id').val(),
243
- 'networkId': jQuery('#b2s-delete-network-id').val()
244
},
245
error: function () {
246
jQuery('.b2s-server-connection-fail').show();
@@ -251,7 +349,7 @@ jQuery(document).on('click', '.b2s-btn-network-delete-auth-confirm-btn', functio
251
jQuery('.b2s-network-auth-area').show();
252
jQuery('.b2s-loading-area').hide();
253
if (data.result == true && data.networkAuthId >= 1 && data.networkId >= 1) {
254
- jQuery('.b2s-network-item-auth-list-btn-delete[data-network-auth-id="' + data.networkAuthId + '"]').parent('li').remove();
255
var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + data.networkId + '"').text();
256
if (networkCount != "0") {
257
var newCount = parseInt(networkCount) - 1;
@@ -302,6 +400,11 @@ jQuery(document).on('click', '.b2s-network-add-mandant-btn-save', function () {
302
jQuery('.b2s-network-add-mandant-error').show();
303
}
304
jQuery('#b2s-network-add-mandant').modal('hide');
305
}
306
});
307
}
@@ -342,13 +445,16 @@ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandan
342
});
343
344
var typ = new Array('Profile', 'Page', 'Group');
345
if (jQuery('#b2sUserLang').val() == 'de') {
346
typ = new Array('Profil', 'Seite', 'Gruppe');
347
}
348
349
if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
350
- var html = "<li class='b2s-network-item-auth-list-li' data-network-auth-id='" + networkAuthId + "' data-network-mandant-id='" + mandandId + "' data-network-id='" + networkId + "' data-network-type='" + networkType + "'>";
351
- html += '<span class="b2s-network-item-auth-type">' + typ[networkType] + '</span>: ';
352
html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
353
if (mandandId >= 0) {
354
var mandantName = jQuery(".b2s-network-mandant-select option:selected").text();
@@ -357,20 +463,48 @@ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandan
357
}
358
html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
359
}
360
- html += '<a class="b2s-network-item-auth-list-btn-delete pull-right" data-network-id="' + networkId + '" data-network-auth-id="' + networkAuthId + '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a></li>';
361
362
- if (jQuery('[class~="b2s-network-item-auth-list-li"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').length > 0) {
363
- jQuery(html).insertBefore('[class~="b2s-network-item-auth-list-li"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]:first');
364
} else {
365
- jQuery('.b2s-network-item-auth-list[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"]').prepend(html);
366
}
367
var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + networkId + '"').text();
368
var newCount = parseInt(networkCount) + 1;
369
jQuery('.b2s-network-auth-count-current[data-network-id="' + networkId + '"').text(newCount);
370
371
} else {
372
- jQuery('.b2s-network-auth-update-btn[data-network-auth-id="' + networkAuthId + '"').hide();
373
- jQuery('.b2s-network-auth-update-label[data-network-auth-id="' + networkAuthId + '"]').hide();
374
if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').length > 0) {
375
var html = '<span class="b2s-network-item-auth-type">' + typ[networkType] + '</span>: ';
376
html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
@@ -381,11 +515,63 @@ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandan
381
}
382
html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
383
}
384
- jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"] span:first').html(html);
385
}
386
}
387
}
388
389
function wop(url, name) {
390
jQuery('.b2s-network-auth-info').hide();
391
jQuery('.b2s-network-auth-success').hide();
@@ -404,3 +590,19 @@ function showFilter(typ) {
404
jQuery('.filterHide').hide();
405
}
406
}
1
jQuery.noConflict();
2
3
jQuery(window).on("load", function () {
4
+
5
+ init();
6
+
7
if (jQuery('.b2s-network-mandant-select').val() == 0 || jQuery('.b2s-network-mandant-select').val() == -1) {
8
jQuery('.b2s-network-mandant-btn-delete').hide();
9
} else {
13
jQuery('.b2s-network-details-container-list[data-mandant-id="' + jQuery('.b2s-network-mandant-select').val() + '"]').show();
14
15
jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
16
+ jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length - 1);
17
});
18
+ });
19
20
21
+ function init() {
22
+ var showMeridian = true;
23
+ if (jQuery('#b2sUserLang').val() == 'de') {
24
+ showMeridian = false;
25
+ }
26
+ jQuery('.b2s-settings-sched-item-input-time').timepicker({
27
+ minuteStep: 15,
28
+ appendWidgetTo: 'body',
29
+ showSeconds: false,
30
+ showMeridian: showMeridian,
31
+ defaultTime: 'current'
32
+ }).on('changeTime.timepicker', function (e) {
33
+ var networkAuthId = jQuery(e.target).attr('data-network-auth-id');
34
+ jQuery('.b2s-settings-sched-item-input-time[data-network-auth-id="' + networkAuthId + '"]').val(e.time.value);
35
+ saveTimeSettings();
36
+ });
37
+ }
38
+
39
+ var timeoutPlus;
40
+ var timeoutMinus;
41
+ jQuery(document).on('mousedown mouseup', '.b2s-sched-manager-item-input-day-btn-plus', function (e) {
42
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
43
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
44
+ if (e.type == "mousedown") {
45
+ timeoutPlus = setInterval(function () {
46
+ if (current < 99) {
47
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current++);
48
+ } else {
49
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(99);
50
+ }
51
+ }, 100);
52
+ } else {
53
+ clearInterval(timeoutPlus);
54
+ saveTimeSettings();
55
+ }
56
+ return false;
57
+ });
58
+
59
+ jQuery(document).on('mousedown mouseup', '.b2s-sched-manager-item-input-day-btn-minus', function (e) {
60
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
61
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
62
+ if (e.type == "mousedown") {
63
+ timeoutMinus = setInterval(function () {
64
+ if (current > 0) {
65
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current--);
66
+ } else {
67
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(0);
68
+ }
69
+ }, 100);
70
+ } else {
71
+ clearInterval(timeoutMinus);
72
+ saveTimeSettings();
73
+ }
74
+ return false;
75
});
76
77
+
78
+ jQuery(document).on('click', '.b2s-sched-manager-item-input-day-btn-minus', function () {
79
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
80
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
81
+ if (current > 0) {
82
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current - 1);
83
+ saveTimeSettings();
84
+ } else {
85
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(0);
86
+ }
87
+ });
88
+ jQuery(document).on('click', '.b2s-sched-manager-item-input-day-btn-plus', function () {
89
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
90
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
91
+ if (current < 99) {
92
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current + 1);
93
+ //TODO is show ALL other same items update
94
+ saveTimeSettings();
95
+ } else {
96
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(99);
97
+ }
98
+
99
+ });
100
+
101
+
102
+
103
jQuery(document).on('change', '.b2s-network-mandant-select', function () {
104
jQuery('.b2s-network-auth-info').hide();
105
if (jQuery(this).val() == 0 || jQuery(this).val() == -1) {
264
});
265
266
267
+ jQuery(document).on('click', '#b2s-delete-network-sched-post', function () {
268
+ if (!jQuery(this).is(":checked")) {
269
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
270
+ jQuery('#b2s-delete-network-sched-post').val('0');
271
+ } else {
272
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').removeAttr('disabled');
273
+ jQuery('#b2s-delete-network-sched-post').val('1');
274
+ }
275
+ });
276
277
jQuery(document).on('click', '.b2s-network-item-auth-list-btn-delete', function () {
278
jQuery('.b2s-loading-area').show();
280
jQuery('#b2s-network-delete-auth').modal('show');
281
jQuery('#b2s-delete-network-auth-id').val(jQuery(this).attr('data-network-auth-id'));
282
jQuery('#b2s-delete-network-id').val(jQuery(this).attr('data-network-id'));
283
+ jQuery('#b2s-delete-network-type').val(jQuery(this).attr('data-network-type'));
284
jQuery('.b2s-server-connection-fail').hide();
285
jQuery('.b2s-btn-network-delete-auth-show-post-text').hide();
286
jQuery('.b2s-btn-network-delete-auth-show-post-btn').hide();
306
jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
307
jQuery('.b2s-btn-network-delete-auth-show-post-btn').show();
308
jQuery('#b2s-btn-network-delete-auth-show-post-count').text(data.count);
309
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
310
} else {
311
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').removeAttr('disabled');
312
}
313
+ jQuery('.b2s-btn-network-delete-auth-confirm-text').show();
314
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').show();
315
+ jQuery('#b2s-delete-network-sched-post').val('0');
316
}
317
});
318
return false;
336
data: {
337
'action': 'b2s_delete_user_auth',
338
'networkAuthId': jQuery('#b2s-delete-network-auth-id').val(),
339
+ 'networkId': jQuery('#b2s-delete-network-id').val(),
340
+ 'networkType': jQuery('#b2s-delete-network-type').val(),
341
+ 'deleteSchedPost': jQuery('#b2s-delete-network-sched-post').val()
342
},
343
error: function () {
344
jQuery('.b2s-server-connection-fail').show();
349
jQuery('.b2s-network-auth-area').show();
350
jQuery('.b2s-loading-area').hide();
351
if (data.result == true && data.networkAuthId >= 1 && data.networkId >= 1) {
352
+ jQuery('.b2s-network-item-auth-list-btn-delete[data-network-auth-id="' + data.networkAuthId + '"]').parent('div').parent('li').remove();
353
var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + data.networkId + '"').text();
354
if (networkCount != "0") {
355
var newCount = parseInt(networkCount) - 1;
400
jQuery('.b2s-network-add-mandant-error').show();
401
}
402
jQuery('#b2s-network-add-mandant').modal('hide');
403
+
404
+ jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
405
+ jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length);
406
+ });
407
+
408
}
409
});
410
}
445
});
446
447
var typ = new Array('Profile', 'Page', 'Group');
448
+ var days = 'Days';
449
if (jQuery('#b2sUserLang').val() == 'de') {
450
typ = new Array('Profil', 'Seite', 'Gruppe');
451
+ days = 'Tage';
452
}
453
454
+ //NEW
455
if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
456
+ var html = "<li class='b2s-network-item-auth-list-li b2s-label-success-border-left' data-network-auth-id='" + networkAuthId + "' data-network-mandant-id='" + mandandId + "' data-network-id='" + networkId + "' data-network-type='" + networkType + "'>";
457
+ html += '<div class="pull-left"><span class="b2s-network-item-auth-type">' + typ[networkType] + '</span>: ';
458
html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
459
if (mandandId >= 0) {
460
var mandantName = jQuery(".b2s-network-mandant-select option:selected").text();
463
}
464
html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
465
}
466
467
+ var today = new Date();
468
+ if (today.getMinutes() >= 30) {
469
+ today.setHours(today.getHours() + 1);
470
+ today.setMinutes(0);
471
+ } else {
472
+ today.setMinutes(30);
473
+ }
474
+ var time = formatAMPM(today);
475
+ if (jQuery('#b2sUserLang').val() == 'de') {
476
+ time = padDate(today.getHours()) + ':' + padDate(today.getMinutes());
477
+ }
478
+
479
+ html += '</div>';
480
+ html += '<div class="pull-right">';
481
+ html += '<a class="b2s-network-item-auth-list-btn-delete b2s-add-padding-network-delete pull-right" data-network-type="' + networkType + '" data-network-id="' + networkId + '" data-network-auth-id="' + networkAuthId + '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
482
+
483
+ if (jQuery('#b2sUserVersion').val() == '0') {
484
+ html += '<span class="b2s-sched-manager-premium-area pull-right hidden-xs" style="width: 240px;"><span class="label label-success"><a href="#" class="btn-label-premium" data-toggle="modal" data-target="#b2sInfoSchedTimesModal">PREMIUM</a></span></span>';
485
} else {
486
+ html += '<span class="b2s-sched-manager-time-area pull-right b2s-sched-manager-add-padding hidden-xs" style="margin-right:30px !important;">';
487
+ html += '<input class="form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time" type="text" value="' + time + '" readonly data-network-auth-id="' + networkAuthId + '" data-network-mandant-id="' + mandandId + '" data-network-id="' + networkId + '" data-network-type="' + networkType + '" name="b2s-user-sched-data[time][' + networkAuthId + ']">';
488
+ html += '</span>';
489
+ html += '<span class="b2s-sched-manager-day-area pull-right hidden-xs" style=""><span class="b2s-sched-manager-item-input-day-btn-minus" data-network-auth-id="' + networkAuthId + '">-</span> <span class="b2s-text-middle">+</span>';
490
+ html += '<input type="text" class="b2s-sched-manager-item-input-day" data-network-auth-id="' + networkAuthId + '" data-network-mandant-id="' + mandandId + '" data-network-id="' + networkId + '" data-network-type="' + networkType + '" name="b2s-user-sched-data[delay_day][' + networkAuthId + ']" value="0" readonly> <span class="b2s-text-middle">' + days + '</span> <span class="b2s-sched-manager-item-input-day-btn-plus" data-network-auth-id="' + networkAuthId + '">+</span></span>';
491
}
492
+ html += '</div>';
493
+ html += '<div class="clearfix"></div>';
494
+ html += '</li>';
495
+
496
+ jQuery(html).insertAfter('.b2s-network-item-auth-list-li[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-view="all"]:first');
497
+ jQuery(html).insertAfter('.b2s-network-item-auth-list-li[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-view="selected"]:first');
498
+ jQuery('.b2s-settings-sched-item-input-time[data-network-auth-id="' + networkAuthId + '"]').val(time);
499
var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + networkId + '"').text();
500
var newCount = parseInt(networkCount) + 1;
501
jQuery('.b2s-network-auth-count-current[data-network-id="' + networkId + '"').text(newCount);
502
+ init();
503
+ saveTimeSettings();
504
505
+ //Update
506
} else {
507
+ jQuery('.b2s-network-auth-update-btn[data-network-auth-id="' + networkAuthId + '"').show();
508
if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').length > 0) {
509
var html = '<span class="b2s-network-item-auth-type">' + typ[networkType] + '</span>: ';
510
html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
515
}
516
html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
517
}
518
+ jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"] div:first').html(html);
519
}
520
}
521
}
522
523
+
524
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
525
+ jQuery('.b2s-server-connection-fail').hide();
526
+ jQuery.ajax({
527
+ url: ajaxurl,
528
+ type: "POST",
529
+ dataType: "json",
530
+ cache: false,
531
+ data: {
532
+ 'action': 'b2s_get_settings_sched_time_default',
533
+ },
534
+ error: function () {
535
+ jQuery('.b2s-server-connection-fail').show();
536
+ return false;
537
+ },
538
+ success: function (data) {
539
+ if (data.result == true) {
540
+ jQuery.each(data.times, function (network_id, time) {
541
+ time.forEach(function (network_type_time, count) {
542
+ if (network_type_time != "") {
543
+ jQuery('.b2s-settings-sched-item-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val(network_type_time);
544
+ count++;
545
+ }
546
+ });
547
+ });
548
+ saveTimeSettings();
549
+ }
550
+ }
551
+ });
552
+ return false;
553
+ });
554
+
555
+ function saveTimeSettings() {
556
+ jQuery('.b2s-settings-user-error').hide();
557
+ jQuery.ajax({
558
+ processData: false,
559
+ url: ajaxurl,
560
+ type: "POST",
561
+ dataType: "json",
562
+ cache: false,
563
+ data: jQuery('#b2sSaveTimeSettings').serialize(),
564
+ error: function () {
565
+ return false;
566
+ },
567
+ success: function (data) {
568
+ if (data.result !== true) {
569
+ jQuery('.b2s-settings-user-error').show();
570
+ }
571
+ }
572
+ });
573
+ }
574
+
575
function wop(url, name) {
576
jQuery('.b2s-network-auth-info').hide();
577
jQuery('.b2s-network-auth-success').hide();
590
jQuery('.filterHide').hide();
591
}
592
}
593
+
594
+
595
+ function formatAMPM(date) {
596
+ var hours = date.getHours();
597
+ var minutes = date.getMinutes();
598
+ var ampm = hours >= 12 ? 'PM' : 'AM';
599
+ hours = hours % 12;
600
+ hours = hours ? hours : 12; // the hour '0' should be '12'
601
+ minutes = minutes < 10 ? '0' + minutes : minutes;
602
+ var strTime = hours + ':' + minutes + ' ' + ampm;
603
+ return strTime;
604
+ }
605
+
606
+ function padDate(n) {
607
+ return ("0" + n).slice(-2);
608
+ }
assets/js/b2s/settings.js CHANGED
@@ -181,41 +181,7 @@ jQuery(document).on('click', '.b2s-upload-image', function () {
181
jQuery(document).on('click', '.b2s-save-settings-pro-info', function () {
182
return false;
183
});
184
- jQuery('#b2sSaveUserSettingsSchedTime').validate({
185
- ignore: "",
186
- errorPlacement: function () {
187
- return false;
188
- },
189
- submitHandler: function (form) {
190
- jQuery('.b2s-settings-user-success').hide();
191
- jQuery('.b2s-settings-user-error').hide();
192
- jQuery(".b2s-loading-area").show();
193
- jQuery(".b2s-user-settings-area").hide();
194
- jQuery('.b2s-server-connection-fail').hide();
195
- jQuery.ajax({
196
- processData: false,
197
- url: ajaxurl,
198
- type: "POST",
199
- dataType: "json",
200
- cache: false,
201
- data: jQuery(form).serialize(),
202
- error: function () {
203
- jQuery('.b2s-server-connection-fail').show();
204
- return false;
205
- },
206
- success: function (data) {
207
- jQuery(".b2s-loading-area").hide();
208
- jQuery(".b2s-user-settings-area").show();
209
- if (data.result == true) {
210
- jQuery('.b2s-settings-user-success').show();
211
- } else {
212
- jQuery('.b2s-settings-user-error').show();
213
- }
214
- }
215
- });
216
- return false;
217
- }
218
- });
219
jQuery(document).on('click', '#b2s-user-network-settings-short-url', function () {
220
jQuery('.b2s-settings-user-success').hide();
221
jQuery('.b2s-settings-user-error').hide();
@@ -582,12 +548,6 @@ jQuery(document).on('click', '#b2s-general-settings-legacy-mode', function () {
582
return false;
583
});
584
585
-
586
- jQuery('#b2s-save-time-settings-btn-trigger').on('click', function () {
587
- jQuery('#b2s-save-time-settings-btn').trigger('click');
588
- });
589
-
590
-
591
jQuery('.b2sSaveUserSettingsPostFormatFb').validate({
592
ignore: "",
593
errorPlacement: function () {
@@ -775,35 +735,6 @@ jQuery('.b2sSaveUserSettingsPostFormatIn').validate({
775
return false;
776
});*/
777
778
- jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
779
- jQuery('.b2s-server-connection-fail').hide();
780
- jQuery.ajax({
781
- url: ajaxurl,
782
- type: "POST",
783
- dataType: "json",
784
- cache: false,
785
- data: {
786
- 'action': 'b2s_get_settings_sched_time_default',
787
- },
788
- error: function () {
789
- jQuery('.b2s-server-connection-fail').show();
790
- return false;
791
- },
792
- success: function (data) {
793
- if (data.result == true) {
794
- jQuery.each(data.times, function (network_id, time) {
795
- time.forEach(function (network_type_time, count) {
796
- if (network_type_time != "") {
797
- jQuery('.b2s-settings-sched-item-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val(network_type_time);
798
- count++;
799
- }
800
- });
801
- });
802
- }
803
- }
804
- });
805
- return false;
806
- });
807
function padDate(n) {
808
return ("0" + n).slice(-2);
809
}
181
jQuery(document).on('click', '.b2s-save-settings-pro-info', function () {
182
return false;
183
});
184
+
185
jQuery(document).on('click', '#b2s-user-network-settings-short-url', function () {
186
jQuery('.b2s-settings-user-success').hide();
187
jQuery('.b2s-settings-user-error').hide();
548
return false;
549
});
550
551
jQuery('.b2sSaveUserSettingsPostFormatFb').validate({
552
ignore: "",
553
errorPlacement: function () {
735
return false;
736
});*/
737
738
function padDate(n) {
739
return ("0" + n).slice(-2);
740
}
assets/js/b2s/ship.js CHANGED
@@ -262,19 +262,23 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function ()
262
jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
263
if (jQuery(this).is(':not(:disabled)')) {
264
var networkAuthId = jQuery(this).attr('data-network-auth-id');
265
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
266
jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
267
var hours = network_type_time.substring(0, 2);
268
- if (lang == "de") {
269
var timeparts = network_type_time.split(' ');
270
- if (timeparts[1] == 'AM') {
271
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
272
- }
273
}
274
if (hours < today.getHours()) {
275
jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
276
} else {
277
jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
278
}
279
}
280
});
@@ -375,60 +379,125 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
375
return false;
376
},
377
success: function (data) {
378
- if (data.result == true) {
379
- var tomorrow = new Date();
380
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
381
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
382
- }
383
384
- tomorrow.setDate(tomorrow.getDate() + 1);
385
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
386
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
387
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
388
- var today = new Date();
389
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
390
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
391
- }
392
393
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
394
- var todayDate = ("0" + today.getDate()).slice(-2);
395
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
396
- var lang = jQuery('#b2sUserLang').val();
397
- if (lang == "de") {
398
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
399
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
400
- }
401
402
- jQuery.each(data.times, function (network_id, time) {
403
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
404
- time.forEach(function (network_type_time, count) {
405
- if (network_type_time != "") {
406
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
407
- if (jQuery(this).is(':not(:disabled)')) {
408
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
409
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
410
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
411
- var hours = network_type_time.substring(0, 2);
412
- if (lang == "de") {
413
- var timeparts = network_type_time.split(' ');
414
- if (timeparts[1] == 'AM') {
415
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
416
- }
417
- }
418
- if (hours < today.getHours()) {
419
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
420
- } else {
421
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
422
}
423
}
424
- });
425
- count++;
426
}
427
- });
428
}
429
});
430
- } else {
431
- jQuery('#b2s-network-no-sched-time-user').modal('show');
432
}
433
}
434
});
@@ -566,12 +635,12 @@ jQuery(document).on("click", ".b2s-user-network-settings-post-format", function
566
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
567
568
//Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
569
- if (networkId == 1 && networkType == 0 && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="'+networkAuthId+'"]').val() != "1") {
570
jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
571
jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
572
jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
573
jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
574
-
575
}
576
577
} else {
@@ -1873,41 +1942,7 @@ jQuery(window).on("load", function () {
1873
defaultTime: 'current'
1874
});
1875
});
1876
- jQuery('#b2s-save-time-settings-btn-trigger').on('click', function () {
1877
- jQuery('#b2s-save-time-settings-btn').trigger('click');
1878
- });
1879
- jQuery('#b2sSaveUserSettingsSchedTime').validate({
1880
- ignore: "",
1881
- errorPlacement: function () {
1882
- return false;
1883
- },
1884
- submitHandler: function (form) {
1885
- jQuery('#b2s-time-settings-modal').modal('hide');
1886
- jQuery('.b2s-settings-user-success').hide();
1887
- jQuery('.b2s-settings-user-error').hide();
1888
- jQuery('.b2s-server-connection-fail').hide();
1889
- jQuery.ajax({
1890
- processData: false,
1891
- url: ajaxurl,
1892
- type: "POST",
1893
- dataType: "json",
1894
- cache: false,
1895
- data: jQuery(form).serialize(),
1896
- error: function () {
1897
- jQuery('.b2s-server-connection-fail').show();
1898
- return false;
1899
- },
1900
- success: function (data) {
1901
- if (data.result == true) {
1902
- jQuery('.b2s-settings-user-success').show();
1903
- } else {
1904
- jQuery('.b2s-settings-user-error').show();
1905
- }
1906
- }
1907
- });
1908
- return false;
1909
- }
1910
- });
1911
jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
1912
var selectedAuth = new Array();
1913
jQuery('.b2s-network-list.active').each(function () {
262
jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
263
if (jQuery(this).is(':not(:disabled)')) {
264
var networkAuthId = jQuery(this).attr('data-network-auth-id');
265
+ //is not set special dates
266
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() != '1') {
267
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
268
+ }
269
jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
270
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
271
var hours = network_type_time.substring(0, 2);
272
+ if (lang == "en") {
273
var timeparts = network_type_time.split(' ');
274
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
275
}
276
if (hours < today.getHours()) {
277
jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
278
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
279
} else {
280
jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
281
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
282
}
283
}
284
});
379
return false;
380
},
381
success: function (data) {
382
+ var tomorrow = new Date();
383
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
384
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
385
+ }
386
387
+ tomorrow.setDate(tomorrow.getDate() + 1);
388
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
389
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
390
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
391
+ var today = new Date();
392
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
393
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
394
+ }
395
396
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
397
+ var todayDate = ("0" + today.getDate()).slice(-2);
398
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
399
+ var lang = jQuery('#b2sUserLang').val();
400
+ if (lang == "de") {
401
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
402
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
403
+ }
404
+ if (data.result == true) {
405
+ //V5.1.0 seeding
406
+ if (data.type == 'new') {
407
+ //new
408
+ jQuery.each(data.times, function (network_auth_id, time) {
409
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
410
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
411
+ //is not set special dates
412
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() != '1') {
413
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
414
+ }
415
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
416
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', time);
417
+ var hours = time.substring(0, 2);
418
+ if (lang == "en") {
419
+ var timeparts = time.split(' ');
420
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
421
+ }
422
423
+ var isDelay = false;
424
+ var delayDay = data.delay_day[network_auth_id];
425
+ if (delayDay != undefined) {
426
+ if (delayDay > 0) {
427
+ var delay = new Date();
428
+ delay.setDate(today.getDate() + parseInt(delayDay));
429
+ var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
430
+ var delayDate = ("0" + delay.getDate()).slice(-2);
431
+ var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
432
+ if (lang == 'de') {
433
+ dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
434
}
435
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
436
+ isDelay = true;
437
+
438
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
439
}
440
+ }
441
+ if (!isDelay) {
442
+ if (hours < today.getHours()) {
443
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
444
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
445
+ } else {
446
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
447
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
448
+ }
449
+ }
450
}
451
+ }
452
+ });
453
+ } else {
454
+ //old
455
+ jQuery.each(data.times, function (network_id, time) {
456
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
457
+ time.forEach(function (network_type_time, count) {
458
+ if (network_type_time != "") {
459
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
460
+ if (jQuery(this).is(':not(:disabled)')) {
461
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
462
+ //is not set special dates
463
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() != '1') {
464
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
465
+ }
466
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
467
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
468
+ var hours = network_type_time.substring(0, 2);
469
+ if (lang == "en") {
470
+ var timeparts = network_type_time.split(' ');
471
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
472
+ }
473
+ if (hours < today.getHours()) {
474
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
475
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
476
+ } else {
477
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
478
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
479
+ }
480
+ }
481
+ });
482
+ count++;
483
+ }
484
+ });
485
+ }
486
+ });
487
+ }
488
+ } else {
489
+ //default load best Times
490
+ //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
491
+ //set current time
492
+ jQuery('.b2s-post-item:visible').each(function () {
493
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
494
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
495
+ //is not set special dates
496
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
497
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
498
+ }
499
}
500
});
501
}
502
}
503
});
635
jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
636
637
//Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
638
+ if (networkId == 1 && networkType == 0 && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
639
jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
640
jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
641
jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
642
jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
643
+
644
}
645
646
} else {
1942
defaultTime: 'current'
1943
});
1944
});
1945
+
1946
jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
1947
var selectedAuth = new Array();
1948
jQuery('.b2s-network-list.active').each(function () {
assets/lib/timepicker/timepicker.js CHANGED
@@ -929,7 +929,6 @@
929
if (!ignoreWidget) {
930
this.updateWidget();
931
}
932
-
933
this.$element.trigger({
934
'type': 'changeTime.timepicker',
935
'time': {
929
if (!ignoreWidget) {
930
this.updateWidget();
931
}
932
this.$element.trigger({
933
'type': 'changeTime.timepicker',
934
'time': {
blog2social.php CHANGED
@@ -6,12 +6,12 @@
6
* Author: Blog2Social, Adenion
7
* Text Domain: blog2social
8
* Domain Path: /languages
9
- * Version: 5.0.4
10
* Author URI: https://www.blog2social.com
11
* License: GPL2+
12
*/
13
//B2SDefine
14
- define('B2S_PLUGIN_VERSION', '504');
15
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
16
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
17
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
6
* Author: Blog2Social, Adenion
7
* Text Domain: blog2social
8
* Domain Path: /languages
9
+ * Version: 5.1.0
10
* Author URI: https://www.blog2social.com
11
* License: GPL2+
12
*/
13
//B2SDefine
14
+ define('B2S_PLUGIN_VERSION', '510');
15
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
16
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
17
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
includes/Ajax/Get.php CHANGED
@@ -23,7 +23,7 @@ class Ajax_Get {
23
add_action('wp_ajax_b2s_post_meta_box', array($this, 'getPostMetaBox'));
24
add_action('wp_ajax_b2s_scrape_url', array($this, 'scrapeUrl'));
25
add_action('wp_ajax_b2s_get_settings_sched_time_default', array($this, 'getSettingsSchedTimeDefault'));
26
- add_action('wp_ajax_b2s_get_settings_sched_time_user', array($this, 'getSettingsSchedTimeUser'));
27
add_action('wp_ajax_b2s_ship_item_full_text', array($this, 'getShipItemFullText'));
28
add_action('wp_ajax_b2s_ship_item_reload_url', array($this, 'getShipItemReloadUrl'));
29
add_action('wp_ajax_b2s_get_faq_entries', array($this, 'getFaqEntries'));
@@ -268,20 +268,38 @@ class Ajax_Get {
268
wp_die();
269
}
270
271
- public function getSettingsSchedTimeUser() {
272
$lang = substr(B2S_LANGUAGE, 0, 2);
273
- global $wpdb;
274
- $userTimes = array();
275
- $saveSchedData = $wpdb->get_results($wpdb->prepare("SELECT network_id, network_type, sched_time FROM b2s_post_sched_settings WHERE blog_user_id= %d", B2S_PLUGIN_BLOG_USER_ID));
276
- if (!empty($saveSchedData) && is_array($saveSchedData)) {
277
- foreach ($saveSchedData as $k => $v) {
278
- $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
279
- $userTimes[$v->network_id][$v->network_type] = date($slug, strtotime(date('Y-m-d ' . $v->sched_time . ':00')));
280
- }
281
- if (!empty($userTimes)) {
282
- echo json_encode(array('result' => true, 'times' => $userTimes));
283
wp_die();
284
}
285
}
286
echo json_encode(array('result' => false));
287
wp_die();
23
add_action('wp_ajax_b2s_post_meta_box', array($this, 'getPostMetaBox'));
24
add_action('wp_ajax_b2s_scrape_url', array($this, 'scrapeUrl'));
25
add_action('wp_ajax_b2s_get_settings_sched_time_default', array($this, 'getSettingsSchedTimeDefault'));
26
+ add_action('wp_ajax_b2s_get_settings_sched_time_user', array($this, 'getUserTimeSettings'));
27
add_action('wp_ajax_b2s_ship_item_full_text', array($this, 'getShipItemFullText'));
28
add_action('wp_ajax_b2s_ship_item_reload_url', array($this, 'getShipItemReloadUrl'));
29
add_action('wp_ajax_b2s_get_faq_entries', array($this, 'getFaqEntries'));
268
wp_die();
269
}
270
271
+ //NEW V5.1.0
272
+ public function getUserTimeSettings() {
273
$lang = substr(B2S_LANGUAGE, 0, 2);
274
+ $options = new B2S_Options(get_current_user_id());
275
+ $userSchedData = $options->_getOption('auth_sched_time');
276
+ if (isset($userSchedData['time'])) {
277
+ if (is_array($userSchedData) && isset($userSchedData['delay_day']) && isset($userSchedData['time']) && is_array($userSchedData['time'])) {
278
+ foreach ($userSchedData['time'] as $k => $v) {
279
+ $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
280
+ $userSchedData['time'][$k] = date($slug, strtotime(date('Y-m-d ' . $v . ':00')));
281
+ }
282
+ echo json_encode(array('result' => true, 'type' => 'new', 'delay_day' => $userSchedData['delay_day'], 'times' => $userSchedData['time']));
283
wp_die();
284
}
285
+ //load old setttings >5.1.0
286
+ } else {
287
+ global $wpdb;
288
+ //if exists
289
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_post_sched_settings'") == 'b2s_post_sched_settings') {
290
+ $userTimes = array();
291
+ $saveSchedData = $wpdb->get_results($wpdb->prepare("SELECT network_id, network_type, sched_time FROM b2s_post_sched_settings WHERE blog_user_id= %d", B2S_PLUGIN_BLOG_USER_ID));
292
+ if (!empty($saveSchedData) && is_array($saveSchedData)) {
293
+ foreach ($saveSchedData as $k => $v) {
294
+ $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
295
+ $userTimes[$v->network_id][$v->network_type] = date($slug, strtotime(date('Y-m-d ' . $v->sched_time . ':00')));
296
+ }
297
+ if (!empty($userTimes)) {
298
+ echo json_encode(array('result' => true, 'type' => 'old', 'times' => $userTimes));
299
+ wp_die();
300
+ }
301
+ }
302
+ }
303
}
304
echo json_encode(array('result' => false));
305
wp_die();
includes/Ajax/Post.php CHANGED
@@ -27,7 +27,7 @@ class Ajax_Post {
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'));
30
- add_action('wp_ajax_b2s_save_user_settings_sched_time', array($this, 'saveUserSettingsSchedTime'));
31
add_action('wp_ajax_b2s_network_save_auth_to_settings', array($this, 'saveAuthToSettings'));
32
add_action('wp_ajax_b2s_prg_login', array($this, 'prgLogin'));
33
add_action('wp_ajax_b2s_prg_logout', array($this, 'prgLogout'));
@@ -670,13 +670,38 @@ class Ajax_Post {
670
}
671
672
public function deleteUserAuth() {
673
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0) {
674
$post = array('token' => B2S_PLUGIN_TOKEN,
675
'action' => 'deleteUserAuth',
676
'networkAuthId' => (int) $_POST['networkAuthId']);
677
$deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
678
if ($deleteResult->result == true) {
679
- global $wpdb;
680
$wpdb->delete('b2s_user_network_settings', array('network_auth_id' => $_POST['networkAuthId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
681
echo json_encode(array('result' => true, 'networkId' => (int) $_POST['networkId'], 'networkAuthId' => (int) $_POST['networkAuthId']));
682
wp_die();
@@ -791,14 +816,16 @@ class Ajax_Post {
791
wp_die();
792
}
793
794
- public function saveUserSettingsSchedTime() {
795
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Settings/Save.php');
796
- if (isset($_POST['b2s']['user-sched-time']) && !empty($_POST['b2s']['user-sched-time'])) {
797
- $settings = new B2S_Settings_Save($_POST['b2s']['user-sched-time']);
798
- if ($settings->saveSchedTime()) {
799
- echo json_encode(array('result' => true));
800
- wp_die();
801
}
802
}
803
echo json_encode(array('result' => false));
804
wp_die();
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'));
30
+ add_action('wp_ajax_b2s_save_user_time_settings', array($this, 'saveUserTimeSettings'));
31
add_action('wp_ajax_b2s_network_save_auth_to_settings', array($this, 'saveAuthToSettings'));
32
add_action('wp_ajax_b2s_prg_login', array($this, 'prgLogin'));
33
add_action('wp_ajax_b2s_prg_logout', array($this, 'prgLogout'));
670
}
671
672
public function deleteUserAuth() {
673
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Tools.php');
674
+ if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType'])) {
675
+ global $wpdb;
676
+ if (isset($_POST['deleteSchedPost']) && (int) $_POST['deleteSchedPost'] == 1) {
677
+ $res = $wpdb->get_results($wpdb->prepare("SELECT b.id, b.post_id, b.post_for_approve, b.post_for_relay FROM b2s_posts b LEFT JOIN b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE d.network_auth_id= %d AND b.hide = %d AND b.publish_date =%s", (int) $_POST['networkAuthId'], 0, '0000-00-00 00:00:00'));
678
+ if (is_array($res) && !empty($res)) {
679
+ foreach ($res as $k => $row) {
680
+ if (isset($row->id) && (int) $row->id > 0) {
681
+ $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
682
+ $wpdb->update('b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $row->id));
683
+ //is post for relay
684
+ if ((int) $row->post_for_relay == 1) {
685
+ $relay = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
686
+ if (is_array($relay) && !empty($relay)) {
687
+ foreach ($relay as $item) {
688
+ if (isset($item->id) && (int) $item->id > 0) {
689
+ $wpdb->update('b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
690
+ }
691
+ }
692
+ }
693
+ }
694
+ }
695
+ }
696
+ B2S_Heartbeat::getInstance()->deleteSchedPost();
697
+ sleep(2);
698
+ }
699
+ }
700
$post = array('token' => B2S_PLUGIN_TOKEN,
701
'action' => 'deleteUserAuth',
702
'networkAuthId' => (int) $_POST['networkAuthId']);
703
$deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
704
if ($deleteResult->result == true) {
705
$wpdb->delete('b2s_user_network_settings', array('network_auth_id' => $_POST['networkAuthId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
706
echo json_encode(array('result' => true, 'networkId' => (int) $_POST['networkId'], 'networkAuthId' => (int) $_POST['networkAuthId']));
707
wp_die();
816
wp_die();
817
}
818
819
+ //NEW V5.1.0
820
+ public function saveUserTimeSettings() {
821
+ if (isset($_POST['b2s-user-sched-data']) && !empty($_POST['b2s-user-sched-data']) && isset($_POST['b2s-user-sched-data']['time']) && isset($_POST['b2s-user-sched-data']['delay_day'])) {
822
+ foreach ($_POST['b2s-user-sched-data']['time'] as $k => $v) {
823
+ $_POST['b2s-user-sched-data']['time'][$k] = date('H:i', strtotime(date('Y-m-d') . ' ' . $v));
824
}
825
+ $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
826
+ $options->_setOption('auth_sched_time', array('delay_day' => $_POST['b2s-user-sched-data']['delay_day'], 'time' => $_POST['b2s-user-sched-data']['time']));
827
+ echo json_encode(array('result' => true));
828
+ wp_die();
829
}
830
echo json_encode(array('result' => false));
831
wp_die();
includes/B2S/AutoPost.php CHANGED
@@ -167,13 +167,19 @@ class B2S_AutoPost {
167
$sched_date_utc = $this->blogPostData['sched_date_utc'];
168
169
//Scheduling post once with user times
170
- if ($sched_type == 2 && $this->myTimeSettings !== false && is_array($this->myTimeSettings) && isset($this->myTimeSettings['times'])) {
171
//Check My Time Setting in Past
172
- foreach ($this->myTimeSettings['times'] as $k => $v) {
173
- if ($v->network_id == $network_id && $v->network_type == $network_type) {
174
- if (isset($v->sched_time) && !empty($v->sched_time)) {
175
- $tempSchedDate = date('Y-m-d', strtotime($sched_date));
176
- $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $v->sched_time));
177
if ($networkSchedDate >= $this->current_user_date) {
178
//Scheduling
179
$sched_date = $networkSchedDate;
@@ -185,6 +191,25 @@ class B2S_AutoPost {
185
}
186
}
187
}
188
}
189
}
190
167
$sched_date_utc = $this->blogPostData['sched_date_utc'];
168
169
//Scheduling post once with user times
170
+ if ($sched_type == 2 && $this->myTimeSettings !== false && is_array($this->myTimeSettings) && isset($this->myTimeSettings['times']) && is_array($this->myTimeSettings['times']) && isset($this->myTimeSettings['type'])) {
171
+ //V 5.1.0 Seeding
172
+ //0=default(best time), 1= special per account (seeding), 2= per network (old)
173
//Check My Time Setting in Past
174
+ //new
175
+ if ($this->myTimeSettings['type'] == 1) {
176
+ if (isset($this->myTimeSettings['times']['delay_day'][$network_auth_id]) && isset($this->myTimeSettings['times']['time'][$network_auth_id]) && !empty($this->myTimeSettings['times']['time'][$network_auth_id])) {
177
+ $tempSchedDate = date('Y-m-d', strtotime($sched_date));
178
+ $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $this->myTimeSettings['times']['time'][$network_auth_id]));
179
+ if ($this->myTimeSettings['times']['delay_day'][$network_auth_id] > 0) {
180
+ $sched_date = date('Y-m-d H:i:s', strtotime('+' . $this->myTimeSettings['times']['delay_day'][$network_auth_id] . ' days', strtotime($networkSchedDate)));
181
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
182
+ } else {
183
if ($networkSchedDate >= $this->current_user_date) {
184
//Scheduling
185
$sched_date = $networkSchedDate;
191
}
192
}
193
}
194
+ //old or default (best time)
195
+ } else {
196
+ foreach ($this->myTimeSettings['times'] as $k => $v) {
197
+ if ($v->network_id == $network_id && $v->network_type == $network_type) {
198
+ if (isset($v->sched_time) && !empty($v->sched_time)) {
199
+ $tempSchedDate = date('Y-m-d', strtotime($sched_date));
200
+ $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $v->sched_time));
201
+ if ($networkSchedDate >= $this->current_user_date) {
202
+ //Scheduling
203
+ $sched_date = $networkSchedDate;
204
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
205
+ } else {
206
+ //Scheduling on next Day by Past
207
+ $sched_date = date('Y-m-d H:i:s', strtotime('+1 days', strtotime($networkSchedDate)));
208
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
209
+ }
210
+ }
211
+ }
212
+ }
213
}
214
}
215
includes/B2S/Heartbeat.php CHANGED
@@ -34,6 +34,10 @@ class B2S_Heartbeat {
34
public function postToServer() {
35
$this->postSchedToServer();
36
}
37
38
private function postSchedToServer() {
39
global $wpdb;
34
public function postToServer() {
35
$this->postSchedToServer();
36
}
37
+ public function deleteSchedPost(){
38
+ $this->deleteUserSchedPost();
39
+ }
40
+
41
42
private function postSchedToServer() {
43
global $wpdb;
includes/B2S/Network/Item.php CHANGED
@@ -9,16 +9,28 @@ class B2S_Network_Item {
9
private $modifyBoardAndGroup;
10
private $oAuthPortal;
11
private $mandantenId;
12
13
public function __construct($load = true) {
14
$this->mandantenId = array(-1, 0); //All,Default
15
if ($load) {
16
$this->authurl = B2S_PLUGIN_API_ENDPOINT_AUTH . '?b2s_token=' . B2S_PLUGIN_TOKEN . '&sprache=' . substr(B2S_LANGUAGE, 0, 2) . '&unset=true';
17
$this->allowProfil = unserialize(B2S_PLUGIN_NETWORK_ALLOW_PROFILE);
18
$this->allowPage = unserialize(B2S_PLUGIN_NETWORK_ALLOW_PAGE);
19
$this->allowGroup = unserialize(B2S_PLUGIN_NETWORK_ALLOW_GROUP);
20
$this->oAuthPortal = unserialize(B2S_PLUGIN_NETWORK_OAUTH);
21
$this->modifyBoardAndGroup = unserialize(B2S_PLUGIN_NETWORK_ALLOW_MODIFY_BOARD_AND_GROUP);
22
}
23
}
24
@@ -64,10 +76,13 @@ class B2S_Network_Item {
64
}
65
66
$html = '<div class="col-md-12 b2s-network-details-container">';
67
68
foreach ($this->mandantenId as $k => $mandant) {
69
$html .= $this->getItemHtml($mandant, $mandanten, $convertAuthData, $portale, $auth_count);
70
}
71
$html .= '</div>';
72
return $html;
73
}
@@ -93,6 +108,7 @@ class B2S_Network_Item {
93
}
94
95
private function getPortaleHtml($networkId, $networkName, $mandantId, $mandantenData, $networkData, $maxNetworkAccount = false, $showAllAuths = false) {
96
$mandantId = ($mandantId == -1) ? 0 : $mandantId;
97
$sprache = substr(B2S_LANGUAGE, 0, 2);
98
$html = '<li class="list-group-item">';
@@ -101,13 +117,19 @@ class B2S_Network_Item {
101
$html .='<div class="media-body network">';
102
$html .= '<h4>' . ucfirst($networkName);
103
if ($maxNetworkAccount !== false) {
104
- $html .=' <span class="b2s-network-auth-count">(' . __("Connections", "blog2social") . ' <span class="b2s-network-auth-count-current" ' . (($showAllAuths) ? 'data-network-count-trigger="true"' : '') . ' data-network-id="' . $networkId . '"></span>/' . $maxNetworkAccount . ')</span>';
105
-
106
- if($networkId == 18){
107
$html .=' <a class="b2s-info-btn" data-target="#b2sInfoNetwork18" data-toggle="modal" href="#">Info</a>';
108
}
109
-
110
}
111
$html .= '<span class="pull-right">';
112
113
$b2sAuthUrl = $this->authurl . '&portal_id=' . $networkId . '&transfer=' . (in_array($networkId, $this->oAuthPortal) ? 'oauth' : 'form' ) . '&mandant_id=' . $mandantId . '&version=3&affiliate_id=' . B2S_Tools::getAffiliateId();
@@ -126,15 +148,22 @@ class B2S_Network_Item {
126
$html .= '<div class="clearfix"></div>';
127
$html .= '<ul class="b2s-network-item-auth-list" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" ' . (($showAllAuths) ? 'data-network-count="true"' : '') . '>';
128
129
if ($showAllAuths) {
130
foreach ($this->mandantenId as $ka => $mandantAll) {
131
$mandantName = isset($mandantenData->{$mandantAll}) ? ($mandantenData->{$mandantAll}) : __("My profile", "blog2social");
132
if (isset($networkData[$mandantAll][$networkId]) && !empty($networkData[$mandantAll][$networkId])) {
133
- $html .= $this->getAuthItemHtml($networkData[$mandantAll][$networkId], $mandantAll, $mandantName, $networkId, $b2sAuthUrl, $sprache);
134
}
135
}
136
} else {
137
- $html .= $this->getAuthItemHtml($networkData, $mandantId, "", $networkId, $b2sAuthUrl, $sprache);
138
}
139
140
$html .= '</ul>';
@@ -144,102 +173,163 @@ class B2S_Network_Item {
144
return $html;
145
}
146
147
- private function getAuthItemHtml($networkData = array(), $mandantId, $mandantName, $networkId, $b2sAuthUrl = '', $sprache = 'en') {
148
$html = '';
149
if (isset($networkData[0])) {
150
foreach ($networkData[0] as $k => $v) {
151
- $html .= '<li class="b2s-network-item-auth-list-li" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="0">';
152
153
- if ($v['notAllow'] !== false) {
154
- $html .='<span class="glyphicon glyphicon-remove-circle glyphicon-danger"></span> <span class="not-allow">' . __('Profile', 'blog2social') . ': ' . stripslashes($v['networkUserName']) . '</span> ';
155
- } else {
156
- $html .= '<span class="b2s-network-item-auth-type">' . __('Profile', 'blog2social') . '</span>: <span class="b2s-network-item-auth-user-name">' . stripslashes($v['networkUserName']) . '</span> ';
157
}
158
159
if (!empty($mandantName)) {
160
$html .='<span class="b2s-network-mandant-name">(' . $mandantName . ')</span> ';
161
}
162
163
-
164
- $html .= '<a class="b2s-network-item-auth-list-btn-delete pull-right" data-network-id="' . $networkId . '" data-network-auth-id="' . $v['networkAuthId'] . '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
165
- $html .= ($v['expiredDate'] != '0000-00-00' && $v['expiredDate'] <= date('Y-m-d')) ? ' <span class="label label-danger b2s-network-auth-update-label" data-network-auth-id="' . $v['networkAuthId'] . '">' . __('Authorization is interrupted since', 'blog2social') . ' ' . ($sprache == 'en' ? $v['expiredDate'] : date('d.m.Y', strtotime($v['expiredDate']))) . '</span>' : '';
166
- if ($v['notAllow'] === false) {
167
- $html .= '<a href="#" onclick="wop(\'' . $b2sAuthUrl . '&choose=profil&update=' . $v['networkAuthId'] . '\', \'Blog2Social Network\'); return false;" class="b2s-network-auth-btn b2s-network-auth-update-btn add-padding-left pull-right" data-network-auth-id="' . $v['networkAuthId'] . '"><span class="glyphicon glyphicon-refresh glyphicon-grey"></span></a>';
168
if ($v['expiredDate'] == '0000-00-00' || $v['expiredDate'] > date('Y-m-d')) {
169
if (isset($this->modifyBoardAndGroup[$networkId])) {
170
if (in_array(0, $this->modifyBoardAndGroup[$networkId]['TYPE'])) {
171
- $html .='<a href="#" class="pull-right b2s-modify-board-and-group-network-btn" data-modal-title="' . $this->modifyBoardAndGroup[$networkId]['TITLE'] . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-id="' . $networkId . '" data-network-type="0"><span class="glyphicon glyphicon-pencil glyphicon-grey"></span></a>';
172
}
173
}
174
}
175
} else {
176
- $html .='<span class="no-allow-info-text">' . __('To reactivate this social media connection,', 'blog2social') . ' <a href="' . B2S_Tools::getSupportLink('affiliate') . '"target="_blank">' . __('please upgrade', 'blog2social') . '</a></span>';
177
}
178
$html .= '<div class="clearfix"></div></li>';
179
}
180
}
181
if (isset($networkData[1])) {
182
foreach ($networkData[1] as $k => $v) {
183
- $html .= '<li class="b2s-network-item-auth-list-li" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="1">';
184
185
- if ($v['notAllow'] !== false) {
186
- $html .='<span class="glyphicon glyphicon-remove-circle glyphicon-danger"></span> <span class="not-allow">' . __('Page', 'blog2social') . ': ' . stripslashes($v['networkUserName']) . '</span> ';
187
- } else {
188
- $html .= '<span class="b2s-network-item-auth-type">' . __('Page', 'blog2social') . '</span>: <span class="b2s-network-item-auth-user-name">' . stripslashes($v['networkUserName']) . '</span> ';
189
}
190
191
if (!empty($mandantName)) {
192
$html .='<span class="b2s-network-mandant-name">(' . $mandantName . ')</span> ';
193
}
194
-
195
- $html .= '<a class="b2s-network-item-auth-list-btn-delete pull-right" data-network-id="' . $networkId . '" data-network-auth-id="' . $v['networkAuthId'] . '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
196
- $html .= ($v['expiredDate'] != '0000-00-00' && $v['expiredDate'] <= date('Y-m-d')) ? ' <span class="label label-danger b2s-network-auth-update-label" data-network-auth-id="' . $v['networkAuthId'] . '">' . __('Authorization is interrupted since', 'blog2social') . ' ' . ($sprache == 'en' ? $v['expiredDate'] : date('d.m.Y', strtotime($v['expiredDate']))) . '</span>' : '';
197
- if ($v['notAllow'] === false) {
198
- $html .= '<a href="#" onclick="wop(\'' . $b2sAuthUrl . '&choose=page&update=' . $v['networkAuthId'] . '\', \'Blog2Social Network\'); return false;" class="b2s-network-auth-btn b2s-network-auth-update-btn pull-right add-padding-left" data-network-auth-id="' . $v['networkAuthId'] . '"><span class="glyphicon glyphicon-refresh glyphicon-grey"></span></a>';
199
if ($v['expiredDate'] == '0000-00-00' || $v['expiredDate'] > date('Y-m-d')) {
200
if (isset($this->modifyBoardAndGroup[$networkId])) {
201
if (in_array(1, $this->modifyBoardAndGroup[$networkId]['TYPE'])) {
202
- $html .='<a href="#" class="pull-right b2s-modify-board-and-group-network-btn" data-modal-title="' . $this->modifyBoardAndGroup[$networkId]['TITLE'] . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-id="' . $networkId . '" data-network-type="1"><span class="glyphicon glyphicon-pencil glyphicon-grey"></span></a>';
203
}
204
}
205
}
206
}
207
- if ($v['notAllow'] !== false) {
208
- $html .='<span class="no-allow-info-text">' . __('To reactivate this social media connection,', 'blog2social') . ' <a href="' . B2S_Tools::getSupportLink('affiliate') . '"target="_blank">' . __('please upgrade', 'blog2social') . '</a></span>';
209
}
210
$html .= '<div class="clearfix"></div></li>';
211
}
212
}
213
if (isset($networkData[2])) {
214
foreach ($networkData[2] as $k => $v) {
215
- $html .= '<li class="b2s-network-item-auth-list-li" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="2">';
216
217
- if ($v['notAllow'] !== false) {
218
- $html .='<span class="glyphicon glyphicon-remove-circle glyphicon-danger"></span> <span class="not-allow">' . __('Group', 'blog2social') . ': ' . stripslashes($v['networkUserName']) . '</span> ';
219
- } else {
220
- $html .= '<span class="b2s-network-item-auth-type">' . __('Group', 'blog2social') . '</span>: <span class="b2s-network-item-auth-user-name">' . stripslashes($v['networkUserName']) . '</span> ';
221
}
222
223
if (!empty($mandantName)) {
224
$html .='<span class="b2s-network-mandant-name">(' . $mandantName . ')</span> ';
225
}
226
-
227
- $html .= '<a class="b2s-network-item-auth-list-btn-delete pull-right" data-network-id="' . $networkId . '" data-network-auth-id="' . $v['networkAuthId'] . '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
228
- $html .= ($v['expiredDate'] != '0000-00-00' && $v['expiredDate'] <= date('Y-m-d')) ? ' <span class="label label-danger b2s-network-auth-update-label" data-network-auth-id="' . $v['networkAuthId'] . '">' . __('Authorization is interrupted since', 'blog2social') . ' ' . ($sprache == 'en' ? $v['expiredDate'] : date('d.m.Y', strtotime($v['expiredDate']))) . '</span>' : '';
229
- if ($v['notAllow'] === false) {
230
- $html .= '<a href="#" onclick="wop(\'' . $b2sAuthUrl . '&choose=group&update=' . $v['networkAuthId'] . '\', \'Blog2Social Network\'); return false;" class="b2s-network-auth-btn b2s-network-auth-update-btn pull-right add-padding-left" data-network-auth-id="' . $v['networkAuthId'] . '"><span class="glyphicon glyphicon-refresh glyphicon-grey"></span></a>';
231
if ($v['expiredDate'] == '0000-00-00' || $v['expiredDate'] > date('Y-m-d')) {
232
if (isset($this->modifyBoardAndGroup[$networkId])) {
233
if (in_array(2, $this->modifyBoardAndGroup[$networkId]['TYPE'])) {
234
- $html .='<a href="#" class="pull-right b2s-modify-board-and-group-network-btn" data-modal-title="' . $this->modifyBoardAndGroup[$networkId]['TITLE'] . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-id="' . $networkId . '" data-network-type="2"><span class="glyphicon glyphicon-pencil glyphicon-grey"></span></a>';
235
}
236
}
237
}
238
}
239
- if ($v['notAllow'] !== false) {
240
- $html .='<span class="no-allow-info-text">' . __('To reactivate this social media connection,', 'blog2social') . ' <a href="' . B2S_Tools::getSupportLink('affiliate') . '"target="_blank">' . __('please upgrade', 'blog2social') . '</a></span>';
241
}
242
243
$html .= '<div class="clearfix"></div></li>';
244
}
245
}
@@ -259,4 +349,46 @@ class B2S_Network_Item {
259
return $convertAuth;
260
}
261
262
}
9
private $modifyBoardAndGroup;
10
private $oAuthPortal;
11
private $mandantenId;
12
+ private $bestTimeInfo;
13
+ private $lang;
14
+ private $options;
15
+ private $userSchedData; // >5.1.0
16
+ private $userSchedDataOld; // <5.1.0
17
18
public function __construct($load = true) {
19
$this->mandantenId = array(-1, 0); //All,Default
20
if ($load) {
21
+ $this->options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
22
+ $this->userSchedData = $this->options->_getOption('auth_sched_time');
23
+ if (!isset($this->userSchedData['time'])) {
24
+ $this->userSchedDataOld = $this->getSchedDataByUser();
25
+ }
26
$this->authurl = B2S_PLUGIN_API_ENDPOINT_AUTH . '?b2s_token=' . B2S_PLUGIN_TOKEN . '&sprache=' . substr(B2S_LANGUAGE, 0, 2) . '&unset=true';
27
$this->allowProfil = unserialize(B2S_PLUGIN_NETWORK_ALLOW_PROFILE);
28
$this->allowPage = unserialize(B2S_PLUGIN_NETWORK_ALLOW_PAGE);
29
$this->allowGroup = unserialize(B2S_PLUGIN_NETWORK_ALLOW_GROUP);
30
$this->oAuthPortal = unserialize(B2S_PLUGIN_NETWORK_OAUTH);
31
+ $this->bestTimeInfo = unserialize(B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO);
32
$this->modifyBoardAndGroup = unserialize(B2S_PLUGIN_NETWORK_ALLOW_MODIFY_BOARD_AND_GROUP);
33
+ $this->lang = substr(B2S_LANGUAGE, 0, 2);
34
}
35
}
36
76
}
77
78
$html = '<div class="col-md-12 b2s-network-details-container">';
79
+ $html .= '<form id = "b2sSaveTimeSettings" method = "post">';
80
+ $html .= '<input id = "action" type = "hidden" value = "b2s_save_user_time_settings" name = "action">';
81
82
foreach ($this->mandantenId as $k => $mandant) {
83
$html .= $this->getItemHtml($mandant, $mandanten, $convertAuthData, $portale, $auth_count);
84
}
85
+ $html .='</form>';
86
$html .= '</div>';
87
return $html;
88
}
108
}
109
110
private function getPortaleHtml($networkId, $networkName, $mandantId, $mandantenData, $networkData, $maxNetworkAccount = false, $showAllAuths = false) {
111
+ $containerMandantId = $mandantId;
112
$mandantId = ($mandantId == -1) ? 0 : $mandantId;
113
$sprache = substr(B2S_LANGUAGE, 0, 2);
114
$html = '<li class="list-group-item">';
117
$html .='<div class="media-body network">';
118
$html .= '<h4>' . ucfirst($networkName);
119
if ($maxNetworkAccount !== false) {
120
+ if ($networkId == 18) {
121
$html .=' <a class="b2s-info-btn" data-target="#b2sInfoNetwork18" data-toggle="modal" href="#">Info</a>';
122
}
123
}
124
+ if (isset($this->bestTimeInfo[$networkId]) && !empty($this->bestTimeInfo[$networkId]) && is_array($this->bestTimeInfo[$networkId])) {
125
+ $time = '';
126
+ $slug = ($this->lang == 'de') ? __('Uhr', 'blog2social') : '';
127
+ foreach ($this->bestTimeInfo[$networkId] as $k => $v) {
128
+ $time .= B2S_Util::getTimeByLang($v[0], $this->lang) . '-' . B2S_Util::getTimeByLang($v[1], $this->lang) . $slug . ', ';
129
+ }
130
+ $html .= '<span class="hidden-xs hidden-sm b2s-sched-manager-best-time-info">(' . __('Best times', 'blog2social') . ': ' . substr($time, 0, -2) . ')</span>';
131
+ }
132
+
133
$html .= '<span class="pull-right">';
134
135
$b2sAuthUrl = $this->authurl . '&portal_id=' . $networkId . '&transfer=' . (in_array($networkId, $this->oAuthPortal) ? 'oauth' : 'form' ) . '&mandant_id=' . $mandantId . '&version=3&affiliate_id=' . B2S_Tools::getAffiliateId();
148
$html .= '<div class="clearfix"></div>';
149
$html .= '<ul class="b2s-network-item-auth-list" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" ' . (($showAllAuths) ? 'data-network-count="true"' : '') . '>';
150
151
+ //First Line
152
+ $html.='<li class="b2s-network-item-auth-list-li" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-view="' . (($containerMandantId == -1) ? 'all' : 'selected') . '">';
153
+ $html.='<span class="b2s-network-auth-count">' . __("Connections", "blog2social") . ' <span class="b2s-network-auth-count-current" ' . (($showAllAuths) ? 'data-network-count-trigger="true"' : '') . ' data-network-id="' . $networkId . '"></span>/' . $maxNetworkAccount . '</span>';
154
+ $html.='<span class="pull-right b2s-sched-manager-title hidden-xs" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '">' . __("Best Time Manager", "blog2social") . ' <a href="#" data-toggle="modal" data-target="#b2sInfoSchedTimesModal" class="b2s-info-btn b2s-load-settings-sched-time-default-info">' . __('Info', 'blog2social') . '</a></span>';
155
+ $html.='</li>';
156
+
157
+
158
if ($showAllAuths) {
159
foreach ($this->mandantenId as $ka => $mandantAll) {
160
$mandantName = isset($mandantenData->{$mandantAll}) ? ($mandantenData->{$mandantAll}) : __("My profile", "blog2social");
161
if (isset($networkData[$mandantAll][$networkId]) && !empty($networkData[$mandantAll][$networkId])) {
162
+ $html .= $this->getAuthItemHtml($networkData[$mandantAll][$networkId], $mandantAll, $mandantName, $networkId, $b2sAuthUrl, $containerMandantId, $sprache);
163
}
164
}
165
} else {
166
+ $html .= $this->getAuthItemHtml($networkData, $mandantId, "", $networkId, $b2sAuthUrl, $containerMandantId, $sprache);
167
}
168
169
$html .= '</ul>';
173
return $html;
174
}
175
176
+ private function getAuthItemHtml($networkData = array(), $mandantId, $mandantName, $networkId, $b2sAuthUrl = '', $containerMandantId = 0, $sprache = 'en') {
177
+ $isEdit = false;
178
$html = '';
179
if (isset($networkData[0])) {
180
foreach ($networkData[0] as $k => $v) {
181
182
+ $isInterrupted = ($v['expiredDate'] != '0000-00-00' && $v['expiredDate'] <= date('Y-m-d')) ? true : false;
183
+ $notAllow = ($v['notAllow'] !== false) ? true : false;
184
+
185
+ $html .= '<li class="b2s-network-item-auth-list-li ' . (($notAllow) ? 'b2s-label-warning-border-left' : (($isInterrupted) ? 'b2s-label-danger-border-left' : '')) . ' " data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="0">';
186
+ $html .='<div class="pull-left">';
187
+
188
+ if ($notAllow) {
189
+ $html.= '<div class="b2s-network-auth-list-info"><span class="glyphicon glyphicon-remove-circle"></span> ' . __('To reactivate this connection,', 'blog2social') . ' <a href="' . B2S_Tools::getSupportLink('affiliate') . '"target="_blank">' . __('please upgrade', 'blog2social') . '</a></div>';
190
+ }
191
+
192
+ if ($isInterrupted && !$notAllow) {
193
+ $html.= '<div class="b2s-network-auth-list-info"><span class="glyphicon glyphicon-remove-circle"></span> ' . __('Authorization is interrupted since', 'blog2social') . ' ' . ($sprache == 'en' ? $v['expiredDate'] : date('d.m.Y', strtotime($v['expiredDate']))) . '</div>';
194
}
195
196
+ $html .= '<span class="b2s-network-item-auth-type">' . __('Profile', 'blog2social') . '</span>: <span class="b2s-network-item-auth-user-name">' . stripslashes($v['networkUserName']) . '</span> ';
197
+
198
if (!empty($mandantName)) {
199
$html .='<span class="b2s-network-mandant-name">(' . $mandantName . ')</span> ';
200
}
201
+ $html .='</div>';
202
203
+ $html .='<div class="pull-right">';
204
+ $html .= '<a class="b2s-network-item-auth-list-btn-delete b2s-add-padding-network-delete pull-right" data-network-type="0" data-network-id="' . $networkId . '" data-network-auth-id="' . $v['networkAuthId'] . '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
205
+ if (!$notAllow) {
206
+ $html .= '<a href="#" onclick="wop(\'' . $b2sAuthUrl . '&choose=profil&update=' . $v['networkAuthId'] . '\', \'Blog2Social Network\'); return false;" class="b2s-network-auth-btn b2s-network-auth-update-btn b2s-add-padding-network-refresh pull-right" data-network-auth-id="' . $v['networkAuthId'] . '"><span class="glyphicon glyphicon-refresh glyphicon-grey"></span></a>';
207
if ($v['expiredDate'] == '0000-00-00' || $v['expiredDate'] > date('Y-m-d')) {
208
if (isset($this->modifyBoardAndGroup[$networkId])) {
209
if (in_array(0, $this->modifyBoardAndGroup[$networkId]['TYPE'])) {
210
+ $html .='<a href="#" class="pull-right b2s-modify-board-and-group-network-btn b2s-add-padding-network-edit" data-modal-title="' . $this->modifyBoardAndGroup[$networkId]['TITLE'] . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-id="' . $networkId . '" data-network-type="0"><span class="glyphicon glyphicon-pencil glyphicon-grey"></span></a>';
211
+ $isEdit = true;
212
}
213
}
214
}
215
+ }
216
+ //Sched Manager since V 5.1.0
217
+ if (B2S_PLUGIN_USER_VERSION > 0) {
218
+ $html .='<span class="b2s-sched-manager-time-area pull-right ' . (!$isEdit ? 'b2s-sched-manager-add-padding' : '') . ' hidden-xs" style="' . (($isInterrupted || $notAllow) ? 'display:none;' : '') . '">
219
+ <input class="form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time" type="text" value="' . $this->getUserSchedTime($v['networkAuthId'], $networkId, 0, 'time') . '" readonly="" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="0" data-network-container-mandant-id="' . $containerMandantId . '" name="b2s-user-sched-data[time][' . $v['networkAuthId'] . ']">
220
+ </span>';
221
+ $html .='<span class="b2s-sched-manager-day-area pull-right hidden-xs" style="' . (($isInterrupted || $notAllow) ? 'display:none;' : '') . '"><span class="b2s-sched-manager-item-input-day-btn-minus" data-network-auth-id="' . $v['networkAuthId'] . '">-</span> <span class="b2s-text-middle">+</span> <input type="text" class="b2s-sched-manager-item-input-day" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="0" data-network-container-mandant-id="' . $containerMandantId . '" name="b2s-user-sched-data[delay_day][' . $v['networkAuthId'] . ']" value="' . $this->getUserSchedTime($v['networkAuthId'], $networkId, 0, 'day') . '" readonly> <span class="b2s-text-middle">' . __('Days', 'blog2social') . '</span> <span class="b2s-sched-manager-item-input-day-btn-plus" data-network-auth-id="' . $v['networkAuthId'] . '">+</span></span>';
222
} else {
223
+ $html .='<span class="b2s-sched-manager-premium-area pull-right hidden-xs"><span class="label label-success"><a href="#" class="btn-label-premium" data-toggle="modal" data-target="#b2sInfoSchedTimesModal">' . __('PREMIUM', 'blog2social') . '</a></span></span>';
224
}
225
+
226
+ $html .='</div>';
227
+
228
$html .= '<div class="clearfix"></div></li>';
229
}
230
}
231
if (isset($networkData[1])) {
232
foreach ($networkData[1] as $k => $v) {
233
234
+ $isInterrupted = ($v['expiredDate'] != '0000-00-00' && $v['expiredDate'] <= date('Y-m-d')) ? true : false;
235
+ $notAllow = ($v['notAllow'] !== false) ? true : false;
236
+
237
+ $html .= '<li class="b2s-network-item-auth-list-li ' . (($notAllow) ? 'b2s-label-warning-border-left' : (($isInterrupted) ? 'b2s-label-danger-border-left' : '')) . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="1">';
238
+ $html .='<div class="pull-left">';
239
+
240
+ if ($notAllow) {
241
+ $html.= '<div class="b2s-network-auth-list-info"><span class="glyphicon glyphicon-remove-circle"></span> ' . __('To reactivate this connection,', 'blog2social') . ' <a href="' . B2S_Tools::getSupportLink('affiliate') . '"target="_blank">' . __('please upgrade', 'blog2social') . '</a></div>';
242
+ }
243
+
244
+ if ($isInterrupted && !$notAllow) {
245
+ $html.= '<div class="b2s-network-auth-list-info">' . __('Authorization is interrupted since', 'blog2social') . ' ' . ($sprache == 'en' ? $v['expiredDate'] : date('d.m.Y', strtotime($v['expiredDate']))) . '</div>';
246
}
247
248
+ $html .= '<span class="b2s-network-item-auth-type">' . __('Page', 'blog2social') . '</span>: <span class="b2s-network-item-auth-user-name">' . stripslashes($v['networkUserName']) . '</span> ';
249
+
250
if (!empty($mandantName)) {
251
$html .='<span class="b2s-network-mandant-name">(' . $mandantName . ')</span> ';
252
}
253
+ $html .='</div>';
254
+ $html .='<div class="pull-right">';
255
+ $html .= '<a class="b2s-network-item-auth-list-btn-delete b2s-add-padding-network-delete pull-right" data-network-type="1" data-network-id="' . $networkId . '" data-network-auth-id="' . $v['networkAuthId'] . '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
256
+ if (!$notAllow) {
257
+ $html .= '<a href="#" onclick="wop(\'' . $b2sAuthUrl . '&choose=page&update=' . $v['networkAuthId'] . '\', \'Blog2Social Network\'); return false;" class="b2s-network-auth-btn b2s-network-auth-update-btn b2s-add-padding-network-refresh pull-right" data-network-auth-id="' . $v['networkAuthId'] . '"><span class="glyphicon glyphicon-refresh glyphicon-grey"></span></a>';
258
if ($v['expiredDate'] == '0000-00-00' || $v['expiredDate'] > date('Y-m-d')) {
259
if (isset($this->modifyBoardAndGroup[$networkId])) {
260
if (in_array(1, $this->modifyBoardAndGroup[$networkId]['TYPE'])) {
261
+ $html .='<a href="#" class="pull-right b2s-modify-board-and-group-network-btn b2s-add-padding-network-edit" data-modal-title="' . $this->modifyBoardAndGroup[$networkId]['TITLE'] . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-id="' . $networkId . '" data-network-type="1"><span class="glyphicon glyphicon-pencil glyphicon-grey"></span></a>';
262
+ $isEdit = true;
263
}
264
}
265
}
266
}
267
+
268
+ //Sched Manager since V 5.1.0
269
+ if (B2S_PLUGIN_USER_VERSION > 0) {
270
+ $html .='<span class="b2s-sched-manager-time-area pull-right ' . (!$isEdit ? 'b2s-sched-manager-add-padding' : '') . ' hidden-xs" style="' . (($isInterrupted || $notAllow) ? 'display:none;' : '') . '">
271
+ <input class="form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time" type="text" value="' . $this->getUserSchedTime($v['networkAuthId'], $networkId, 1, 'time') . '" readonly="" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="1" data-network-container-mandant-id="' . $containerMandantId . '" name="b2s-user-sched-data[time][' . $v['networkAuthId'] . ']">
272
+ </span>';
273
+ $html .='<span class="b2s-sched-manager-day-area pull-right hidden-xs" style="' . (($isInterrupted || $notAllow) ? 'display:none;' : '') . '"><span class="b2s-sched-manager-item-input-day-btn-minus" data-network-auth-id="' . $v['networkAuthId'] . '">-</span> <span class="b2s-text-middle">+</span> <input type="text" class="b2s-sched-manager-item-input-day" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="1" data-network-container-mandant-id="' . $containerMandantId . '" name="b2s-user-sched-data[delay_day][' . $v['networkAuthId'] . ']" value="' . $this->getUserSchedTime($v['networkAuthId'], $networkId, 1, 'day') . '" readonly> <span class="b2s-text-middle">' . __('Days', 'blog2social') . '</span> <span class="b2s-sched-manager-item-input-day-btn-plus" data-network-auth-id="' . $v['networkAuthId'] . '">+</span></span>';
274
+ } else {
275
+ $html .='<span class="b2s-sched-manager-premium-area pull-right hidden-xs"><span class="label label-success"><a href="#" class="btn-label-premium" data-toggle="modal" data-target="#b2sInfoSchedTimesModal">' . __('PREMIUM', 'blog2social') . '</a></span></span>';
276
}
277
+
278
+ $html .='</div>';
279
+
280
$html .= '<div class="clearfix"></div></li>';
281
}
282
}
283
if (isset($networkData[2])) {
284
foreach ($networkData[2] as $k => $v) {
285
286
+ $isInterrupted = ($v['expiredDate'] != '0000-00-00' && $v['expiredDate'] <= date('Y-m-d')) ? true : false;
287
+ $notAllow = ($v['notAllow'] !== false) ? true : false;
288
+
289
+ $html .= '<li class="b2s-network-item-auth-list-li ' . (($notAllow) ? 'b2s-label-warning-border-left' : (($isInterrupted) ? 'b2s-label-danger-border-left' : '')) . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="2">';
290
+
291
+ $html .='<div class="pull-left">';
292
+
293
+ if ($notAllow) {
294
+ $html.= '<div class="b2s-network-auth-list-info"><span class="glyphicon glyphicon-remove-circle"></span> ' . __('To reactivate this connection,', 'blog2social') . ' <a href="' . B2S_Tools::getSupportLink('affiliate') . '"target="_blank">' . __('please upgrade', 'blog2social') . '</a></div>';
295
}
296
297
+ if ($isInterrupted && !$notAllow) {
298
+ $html.= '<div class="b2s-network-auth-list-info">' . __('Authorization is interrupted since', 'blog2social') . ' ' . ($sprache == 'en' ? $v['expiredDate'] : date('d.m.Y', strtotime($v['expiredDate']))) . '</div>';
299
+ }
300
+
301
+ $html .= '<span class="b2s-network-item-auth-type">' . __('Group', 'blog2social') . '</span>: <span class="b2s-network-item-auth-user-name">' . stripslashes($v['networkUserName']) . '</span> ';
302
+
303
if (!empty($mandantName)) {
304
$html .='<span class="b2s-network-mandant-name">(' . $mandantName . ')</span> ';
305
}
306
+ $html .='</div>';
307
+ $html .='<div class="pull-right">';
308
+ $html .= '<a class="b2s-network-item-auth-list-btn-delete b2s-add-padding-network-delete pull-right" data-network-type="2" data-network-id="' . $networkId . '" data-network-auth-id="' . $v['networkAuthId'] . '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
309
+ if (!$notAllow) {
310
+ $html .= '<a href="#" onclick="wop(\'' . $b2sAuthUrl . '&choose=group&update=' . $v['networkAuthId'] . '\', \'Blog2Social Network\'); return false;" class="b2s-network-auth-btn b2s-network-auth-update-btn b2s-add-padding-network-refresh pull-right" data-network-auth-id="' . $v['networkAuthId'] . '"><span class="glyphicon glyphicon-refresh glyphicon-grey"></span></a>';
311
if ($v['expiredDate'] == '0000-00-00' || $v['expiredDate'] > date('Y-m-d')) {
312
if (isset($this->modifyBoardAndGroup[$networkId])) {
313
if (in_array(2, $this->modifyBoardAndGroup[$networkId]['TYPE'])) {
314
+ $html .='<a href="#" class="pull-right b2s-modify-board-and-group-network-btn b2s-add-padding-network-edit" data-modal-title="' . $this->modifyBoardAndGroup[$networkId]['TITLE'] . '" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-id="' . $networkId . '" data-network-type="2"><span class="glyphicon glyphicon-pencil glyphicon-grey"></span></a>';
315
+ $isEdit = true;
316
}
317
}
318
}
319
}
320
+
321
+ //Sched Manager since V 5.1.0
322
+ if (B2S_PLUGIN_USER_VERSION > 0) {
323
+ $html .='<span class="b2s-sched-manager-time-area pull-right ' . (!$isEdit ? 'b2s-sched-manager-add-padding' : '') . ' hidden-xs" style="' . (($isInterrupted || $notAllow) ? 'display:none;' : '') . '">
324
+ <input class="form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time" type="text" value="' . $this->getUserSchedTime($v['networkAuthId'], $networkId, 2, 'time') . '" readonly="" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="2" data-network-container-mandant-id="' . $containerMandantId . '" name="b2s-user-sched-data[time][' . $v['networkAuthId'] . ']">
325
+ </span>';
326
+ $html .='<span class="b2s-sched-manager-day-area pull-right hidden-xs" style="' . (($isInterrupted || $notAllow) ? 'display:none;' : '') . '"><span class="b2s-sched-manager-item-input-day-btn-minus" data-network-auth-id="' . $v['networkAuthId'] . '">-</span> <span class="b2s-text-middle">+</span> <input type="text" class="b2s-sched-manager-item-input-day" data-network-auth-id="' . $v['networkAuthId'] . '" data-network-mandant-id="' . $mandantId . '" data-network-id="' . $networkId . '" data-network-type="2" data-network-container-mandant-id="' . $containerMandantId . '" name="b2s-user-sched-data[delay_day][' . $v['networkAuthId'] . ']" value="' . $this->getUserSchedTime($v['networkAuthId'], $networkId, 2, 'day') . '" readonly> <span class="b2s-text-middle">' . __('Days', 'blog2social') . '</span> <span class="b2s-sched-manager-item-input-day-btn-plus" data-network-auth-id="' . $v['networkAuthId'] . '">+</span></span>';
327
+ } else {
328
+ $html .='<span class="b2s-sched-manager-premium-area pull-right hidden-xs"><span class="label label-success"><a href="#" class="btn-label-premium" data-toggle="modal" data-target="#b2sInfoSchedTimesModal">' . __('PREMIUM', 'blog2social') . '</a></span></span>';
329
}
330
331
+ $html .='</div>';
332
+
333
$html .= '<div class="clearfix"></div></li>';
334
}
335
}
349
return $convertAuth;
350
}
351
352
+ //New >V5.1.0 Seeding
353
+ private function getUserSchedTime($network_auth_id = 0, $network_id = 0, $network_type = 0, $type = 'time') { //type = time,day
354
+ //new > v5.1.0
355
+ if ($this->userSchedData !== false) {
356
+ if (is_array($this->userSchedData) && isset($this->userSchedData['delay_day'][$network_auth_id]) && isset($this->userSchedData['time'][$network_auth_id]) && !empty($this->userSchedData['time'][$network_auth_id])) {
357
+ if ($type == 'time') {
358
+ $slug = ($this->lang == 'en') ? 'h:i A' : 'H:i';
359
+ return date($slug, strtotime(date('Y-m-d ' . $this->userSchedData['time'][$network_auth_id] . ':00')));
360
+ }
361
+ if ($type == 'day') {
362
+ return (int) $this->userSchedData['delay_day'][$network_auth_id];
363
+ }
364
+ }
365
+ }
366
+ //old < 5.1.0 load data
367
+ if (!empty($this->userSchedDataOld) && is_array($this->userSchedDataOld)) {
368
+ if ($type == 'time') {
369
+ foreach ($this->userSchedDataOld as $k => $v) {
370
+ if ((int) $network_id == (int) $v->network_id && (int) $network_type == (int) $v->network_type) {
371
+ $slug = ($this->lang == 'en') ? 'h:i A' : 'H:i';
372
+ return date($slug, strtotime(date('Y-m-d ' . $v->sched_time . ':00')));
373
+ }
374
+ }
375
+ }
376
+ }
377
+ if ($type == 'day') {
378
+ return 0;
379
+ }
380
+ return null;
381
+ }
382
+
383
+ //Old < 5.1.0
384
+ private function getSchedDataByUser() {
385
+ global $wpdb;
386
+ $saveSchedData = null;
387
+ //if exists
388
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_post_sched_settings'") == 'b2s_post_sched_settings') {
389
+ $saveSchedData = $wpdb->get_results($wpdb->prepare("SELECT network_id, network_type, sched_time FROM b2s_post_sched_settings WHERE blog_user_id= %d", B2S_PLUGIN_BLOG_USER_ID));
390
+ }
391
+ return $saveSchedData;
392
+ }
393
+
394
}
includes/B2S/PostBox.php CHANGED
@@ -4,10 +4,12 @@ class B2S_PostBox {
4
5
private $b2sSiteUrl;
6
private $postLang;
7
8
public function __construct() {
9
$this->b2sSiteUrl = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/');
10
$this->postLang = strtolower(substr(get_locale(), 0, 2));
11
}
12
13
public function getPostBox($postId = 0, $postType = 'post', $postStatus = '') {
@@ -18,9 +20,9 @@ class B2S_PostBox {
18
//Unlock Auto-Post-Import
19
delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . B2S_PLUGIN_BLOG_USER_ID);
20
21
- $userOption = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
22
- $autoPostOption = $userOption->_getOption('auto_post');
23
- $optionUserTimeZone = $userOption->_getOption('user_time_zone');
24
$userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
25
$userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
26
$selectedProfileID = get_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . B2S_PLUGIN_BLOG_USER_ID);
@@ -46,7 +48,7 @@ class B2S_PostBox {
46
}
47
}
48
//Auto-Post-Import - Check Conditions - show notice
49
- $autoPostData = $userOption->_getOption('auto_post_import');
50
if ($autoPostData !== false && is_array($autoPostData)) {
51
if (isset($autoPostData['active']) && (int) $autoPostData['active'] == 1) {
52
$autoPostImport = true;
@@ -63,7 +65,7 @@ class B2S_PostBox {
63
}
64
}
65
}
66
- $autoPostCon = $userOption->_getOption('auto_post_import_condition');
67
if ($autoPostCon !== false && is_array($autoPostCon) && isset($autoPostCon['count'])) {
68
$con = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
69
if ($autoPostCon['count'] == $con[B2S_PLUGIN_USER_VERSION]) {
@@ -185,7 +187,7 @@ class B2S_PostBox {
185
}
186
$content .= '</select></div>';
187
$content .= $authContent;
188
-
189
//TOS Twitter 032018 - none multiple Accounts - User select once
190
$content .='<div class="b2s-meta-box-auto-post-twitter-profile"><label for="b2s-post-meta-box-profil-dropdown-twitter">' . __('Select Twitter profile:', 'blog2social') . '</div></label> <select style="width:100%;" id="b2s-post-meta-box-profil-dropdown-twitter" name="b2s-post-meta-box-profil-dropdown-twitter">';
191
foreach ($mandant as $k => $m) {
@@ -200,11 +202,24 @@ class B2S_PostBox {
200
$content .= '</select></div>';
201
202
203
- //Opt: Get Best Time Settings
204
- global $wpdb;
205
- $bestTimeSettings = '';
206
- $myBestTimeSettings = $wpdb->get_results($wpdb->prepare("SELECT network_id, network_type, sched_time FROM b2s_post_sched_settings WHERE blog_user_id= %d", B2S_PLUGIN_BLOG_USER_ID));
207
-
208
$content .='<label>' . __('When do you want to share your post on social media?', 'blog2social') . '</label>';
209
$content .= '<div class="b2s-post-meta-box-sched-area">';
210
$content .='<select class="b2s-post-meta-box-sched-select" style="width:100%;" name="b2s-post-meta-box-sched-select">
@@ -224,10 +239,10 @@ class B2S_PostBox {
224
225
//Opt: Best Time Settings
226
if (!empty($myBestTimeSettings) && is_array($myBestTimeSettings)) {
227
- $bestTimeSettings = array('my_times' => 1, 'times' => $myBestTimeSettings);
228
$content .="<input id='b2s-post-meta-box-best-time-settings' class='post-format' name='b2s-post-meta-box-best-time-settings' value='" . serialize($bestTimeSettings) . "' type='checkbox'> ";
229
$content .="<label class='post-format-icon' for='b2s-post-meta-box-best-time-settings'>" . __('post at', 'blog2social');
230
- $content .=' <a href="' . $this->b2sSiteUrl . 'wp-admin/admin.php?page=blog2social-settings' . '" target="_blank">' . __('my time settings', 'blog2social') . '</a></label>';
231
$content .='<br><hr><span>' . __('Note: If you ​have​ not ​specified​ your own times, we automatically provide you with the best times to post​ on the social networks. You can always ​edit​ your own times in the settings.', 'blog2social') . '</span>';
232
}
233
$content .="</div>";
4
5
private $b2sSiteUrl;
6
private $postLang;
7
+ private $userOption;
8
9
public function __construct() {
10
$this->b2sSiteUrl = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/');
11
$this->postLang = strtolower(substr(get_locale(), 0, 2));
12
+ $this->userOption = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
13
}
14
15
public function getPostBox($postId = 0, $postType = 'post', $postStatus = '') {
20
//Unlock Auto-Post-Import
21
delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . B2S_PLUGIN_BLOG_USER_ID);
22
23
+
24
+ $autoPostOption = $this->userOption->_getOption('auto_post');
25
+ $optionUserTimeZone = $this->userOption->_getOption('user_time_zone');
26
$userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
27
$userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
28
$selectedProfileID = get_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . B2S_PLUGIN_BLOG_USER_ID);
48
}
49
}
50
//Auto-Post-Import - Check Conditions - show notice
51
+ $autoPostData = $this->userOption->_getOption('auto_post_import');
52
if ($autoPostData !== false && is_array($autoPostData)) {
53
if (isset($autoPostData['active']) && (int) $autoPostData['active'] == 1) {
54
$autoPostImport = true;
65
}
66
}
67
}
68
+ $autoPostCon = $this->userOption->_getOption('auto_post_import_condition');
69
if ($autoPostCon !== false && is_array($autoPostCon) && isset($autoPostCon['count'])) {
70
$con = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
71
if ($autoPostCon['count'] == $con[B2S_PLUGIN_USER_VERSION]) {
187
}
188
$content .= '</select></div>';
189
$content .= $authContent;
190
+
191
//TOS Twitter 032018 - none multiple Accounts - User select once
192
$content .='<div class="b2s-meta-box-auto-post-twitter-profile"><label for="b2s-post-meta-box-profil-dropdown-twitter">' . __('Select Twitter profile:', 'blog2social') . '</div></label> <select style="width:100%;" id="b2s-post-meta-box-profil-dropdown-twitter" name="b2s-post-meta-box-profil-dropdown-twitter">';
193
foreach ($mandant as $k => $m) {
202
$content .= '</select></div>';
203
204
205
+ //new V5.1.0 Seeding
206
+ $bestTimeType = 0; //0=default(best time), 1= special per account (seeding), 2= per network (old)
207
+ $myBestTimeSettings = $this->userOption->_getOption('auth_sched_time');
208
+ if (isset($myBestTimeSettings['time'])) {
209
+ $bestTimeType = 1;
210
+ //old
211
+ } else {
212
+ global $wpdb;
213
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_post_sched_settings'") == 'b2s_post_sched_settings') {
214
+ $myBestTimeSettings = $wpdb->get_results($wpdb->prepare("SELECT network_id, network_type, sched_time FROM b2s_post_sched_settings WHERE blog_user_id= %d", B2S_PLUGIN_BLOG_USER_ID));
215
+ if (is_array($myBestTimeSettings) && !empty($myBestTimeSettings)) {
216
+ $bestTimeType = 2;
217
+ } else {
218
+ //default
219
+ $myBestTimeSettings = B2S_Tools::getRandomBestTimeSettings();
220
+ }
221
+ }
222
+ }
223
$content .='<label>' . __('When do you want to share your post on social media?', 'blog2social') . '</label>';
224
$content .= '<div class="b2s-post-meta-box-sched-area">';
225
$content .='<select class="b2s-post-meta-box-sched-select" style="width:100%;" name="b2s-post-meta-box-sched-select">
239
240
//Opt: Best Time Settings
241
if (!empty($myBestTimeSettings) && is_array($myBestTimeSettings)) {
242
+ $bestTimeSettings = array('type' => $bestTimeType, 'times' => $myBestTimeSettings);
243
$content .="<input id='b2s-post-meta-box-best-time-settings' class='post-format' name='b2s-post-meta-box-best-time-settings' value='" . serialize($bestTimeSettings) . "' type='checkbox'> ";
244
$content .="<label class='post-format-icon' for='b2s-post-meta-box-best-time-settings'>" . __('post at', 'blog2social');
245
+ $content .=' <a href="' . $this->b2sSiteUrl . 'wp-admin/admin.php?page=blog2social-network' . '" target="_blank">' . __('my time settings', 'blog2social') . '</a></label>';
246
$content .='<br><hr><span>' . __('Note: If you ​have​ not ​specified​ your own times, we automatically provide you with the best times to post​ on the social networks. You can always ​edit​ your own times in the settings.', 'blog2social') . '</span>';
247
}
248
$content .="</div>";
includes/B2S/Settings/Item.php CHANGED
@@ -19,7 +19,6 @@ class B2S_Settings_Item {
19
20
public function __construct() {
21
$this->getSettings();
22
- $this->getSchedDataByUser();
23
$this->options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
24
$this->generalOptions = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
25
$this->lang = substr(B2S_LANGUAGE, 0, 2);
@@ -43,26 +42,6 @@ class B2S_Settings_Item {
43
}
44
}
45
46
- public function getSchedDataByUser() {
47
- global $wpdb;
48
- $saveSchedData = $wpdb->get_results($wpdb->prepare("SELECT network_id, network_type, sched_time FROM b2s_post_sched_settings WHERE blog_user_id= %d", B2S_PLUGIN_BLOG_USER_ID));
49
- if (!empty($saveSchedData)) {
50
- $this->userSchedTimeData = $saveSchedData;
51
- }
52
- }
53
-
54
- private function selectSchedTime($network_id = 0, $network_type = 0) {
55
- if (!empty($this->userSchedTimeData) && is_array($this->userSchedTimeData)) {
56
- foreach ($this->userSchedTimeData as $k => $v) {
57
- if ((int) $network_id == (int) $v->network_id && (int) $network_type == (int) $v->network_type) {
58
- $slug = ($this->lang == 'en') ? 'h:i A' : 'H:i';
59
- return date($slug, strtotime(date('Y-m-d ' . $v->sched_time . ':00')));
60
- }
61
- }
62
- }
63
- return null;
64
- }
65
-
66
public function getGeneralSettingsHtml() {
67
68
$isCheckedAllowShortcode = (get_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID) !== false) ? 1 : 0;
@@ -526,64 +505,6 @@ class B2S_Settings_Item {
526
return $content;
527
}
528
529
- public function getSchedSettingsHtml() {
530
- if (!empty($this->networkData)) {
531
- $isPremium = (B2S_PLUGIN_USER_VERSION == 0) ? 'class="b2s-btn-disabled"' : '';
532
- $content = '<form id = "b2sSaveUserSettingsSchedTime" method = "post" ' . $isPremium . '>
533
- <ul class = "list-group b2s-settings-sched-details-container-list">';
534
- foreach ($this->networkData as $k => $v) {
535
- $content .= '<li class = "list-group-item">
536
- <div class = "media">
537
- <img class = "pull-left hidden-xs b2s-img-network" src = "' . plugins_url('/assets/images/portale/' . $v->id . '_flat.png', B2S_PLUGIN_FILE) . '" alt = "' . $v->name . '">
538
- <div class = "media-body network">
539
- <h4><span class = "pull-left">' . ucfirst($v->name) . '</span>
540
- <div class = "b2s-box-sched-time-area">';
541
-
542
- $content .= '<div class = "col-xs-12">
543
- <div class = "form-group col-xs-2">
544
- <label class = "b2s-box-sched-time-area-label">' . __('Profile', 'blog2social') . '</label>
545
- <input class = "form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time form-control valid" type = "text" value = "' . $this->selectSchedTime($v->id, 0) . '" readonly = "" data-network-id = "' . $v->id . '" data-network-type = "0" name = "b2s[user-sched-time][' . $v->id . '][0]">';
546
- if (in_array($v->id, $this->allowPage)) {
547
- $content .= '<label class = "b2s-box-sched-time-area-label">' . __('Page', 'blog2social') . '</label>
548
- <input class = "form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time form-control valid" type = "text" value = "' . $this->selectSchedTime($v->id, 1) . '" readonly = "" data-network-id = "' . $v->id . '" data-network-type = "1" name = "b2s[user-sched-time][' . $v->id . '][1]">';
549
- }
550
- if (in_array($v->id, $this->allowGroup)) {
551
- $content .= '<label class = "b2s-box-sched-time-area-label">' . __('Group', 'blog2social') . '</label>
552
- <input class = "form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time form-control valid" type = "text" value = "' . $this->selectSchedTime($v->id, 2) . '" readonly = "" data-network-id = "' . $v->id . '" data-network-type = "2" name = "b2s[user-sched-time][' . $v->id . '][2]">';
553
- }
554
- $content .= '</div>';
555
-
556
- if (isset($this->timeInfo[$v->id]) && !empty($this->timeInfo[$v->id]) && is_array($this->timeInfo[$v->id])) {
557
- $time = '';
558
- $slug = ($this->lang == 'de') ? __('Uhr', 'blog2social') : '';
559
- foreach ($this->timeInfo[$v->id] as $k => $v) {
560
- $time .= B2S_Util::getTimeByLang($v[0], $this->lang) . '-' . B2S_Util::getTimeByLang($v[1], $this->lang) . $slug . ', ';
561
- }
562
- $content .= '<div class = "form-group col-xs-10 hidden-xs hidden-sm"><div class = "b2s-settings-sched-time-info">' . __('Best times to post', 'blog2social') . ': ' . substr($time, 0, -2) . '</div></div>';
563
- }
564
- $content .= '</div>
565
- </div>
566
- </h4>
567
- </div>
568
- </div>
569
- </li>';
570
- }
571
- $content .= '</ul><div class = "pull-right">';
572
- if (B2S_PLUGIN_USER_VERSION > 0) {
573
- $content .= '<button id="b2s-save-time-settings-btn" class = "btn btn-primary" type = "submit">';
574
- } else {
575
- $content .= '<button id="b2s-save-time-settings-btn" class= "btn btn-primary b2s-btn-disabled b2s-save-settings-pro-info" data-title = "' . __('You want to schedule your posts and use the Best Time Scheduler?', 'blog2social') . '" data-toggle = "modal" data-target = "#b2sInfoSchedTimesModal">';
576
- }
577
- $content .= __('save', 'blog2social') . '</button>';
578
- $content .= '</div>';
579
- $content .= '<input id = "action" type = "hidden" value = "b2s_save_user_settings_sched_time" name = "action">';
580
- $content .= '</form>';
581
- } else {
582
- $content = '<div class = "alert alert-info">' . __('Sorry, we can not load your data at the moment...', 'blog2social') . '</div>';
583
- }
584
- return $content;
585
- }
586
-
587
private function getPostTypesHtml($selected = array(), $type = 'publish') {
588
$content = '';
589
$selected = (is_array($selected) && isset($selected[$type])) ? $selected[$type] : array();
19
20
public function __construct() {
21
$this->getSettings();
22
$this->options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
23
$this->generalOptions = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
24
$this->lang = substr(B2S_LANGUAGE, 0, 2);
42
}
43
}
44
45
public function getGeneralSettingsHtml() {
46
47
$isCheckedAllowShortcode = (get_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID) !== false) ? 1 : 0;
505
return $content;
506
}
507
508
private function getPostTypesHtml($selected = array(), $type = 'publish') {
509
$content = '';
510
$selected = (is_array($selected) && isset($selected[$type])) ? $selected[$type] : array();
includes/B2S/Settings/Save.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- class B2S_Settings_Save {
4
-
5
- private $data;
6
-
7
- public function __construct($data = array()) {
8
- $this->data = $data;
9
- }
10
-
11
- public function saveSchedTime() {
12
-
13
- if (!empty($this->data) && is_array($this->data)) {
14
- global $wpdb;
15
- foreach ($this->data as $k => $times) {
16
- foreach ($times as $t => $v) {
17
- $settingsId = $wpdb->get_var($wpdb->prepare("SELECT id FROM b2s_post_sched_settings WHERE blog_user_id= %d AND network_id=%d AND network_type=%d", B2S_PLUGIN_BLOG_USER_ID, (int) $k, (int) $t));
18
- $dateTime = date('Y-m-d') . ' ' . $v;
19
- $schedTime = date('H:i', strtotime($dateTime));
20
- if ((int) $settingsId > 0) {
21
- $wpdb->update('b2s_post_sched_settings', array('sched_time' => $schedTime), array('id' => $settingsId), array('%s'), array('%d'));
22
- } else {
23
- $wpdb->insert('b2s_post_sched_settings', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'network_id' => (int) $k, 'network_type' => (int) $t, 'sched_time' => $schedTime), array('%d', '%d','%d', '%s'));
24
- }
25
- }
26
- }
27
- return true;
28
- }
29
- return false;
30
- }
31
-
32
- }
includes/B2S/Ship/Item.php CHANGED
@@ -17,7 +17,7 @@ class B2S_Ship_Item {
17
private $onlyImage = array(6, 7, 12);
18
private $allowNoImageProfile = array(5, 9);
19
private $allowNoCustomImageProfile = array(8, 15);
20
- private $allowNoEmoji = array(3, 9, 13, 14, 15, 16, 18);
21
private $allowNoImagePage = array(8);
22
private $allowEditUrl = array(1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18);
23
private $showBoards = array(6);
17
private $onlyImage = array(6, 7, 12);
18
private $allowNoImageProfile = array(5, 9);
19
private $allowNoCustomImageProfile = array(8, 15);
20
+ private $allowNoEmoji = array(9, 13, 14, 15, 16, 18);
21
private $allowNoImagePage = array(8);
22
private $allowEditUrl = array(1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18);
23
private $showBoards = array(6);
includes/Loader.php CHANGED
@@ -284,7 +284,7 @@ class B2S_Loader {
284
}
285
286
public function b2s_load_post_box() {
287
-
288
$post_types = get_post_types(array('public' => true));
289
if (is_array($post_types) && !empty($post_types)) {
290
foreach ($post_types as $post_type) {
@@ -304,7 +304,7 @@ class B2S_Loader {
304
305
wp_nonce_field("b2s-meta-box-nonce-post-area", "b2s-meta-box-nonce");
306
$postId = (isset($_GET['post']) && (int) $_GET['post'] > 0) ? (int) $_GET['post'] : 0;
307
- $postType = (isset($_GET['post_type']) && !empty($_GET['post_type'])) ? $_GET['post_type'] : get_post_type($postId) ;
308
$postStatus = ($postId != 0) ? get_post_status($postId) : '';
309
$postBox = new B2S_PostBox();
310
echo $postBox->getPostBox($postId, $postType, $postStatus);
@@ -322,200 +322,201 @@ class B2S_Loader {
322
323
public function b2s_save_post_box() {
324
325
- if(!isset($_POST['wphb-clear-cache'])){ // WP-Hummingbird BTN clear cache - protection
326
- if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
327
- if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
328
- //Gutenberg WP V5.0 - B2S V5.1.0 optimization
329
- if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
330
- $content = get_post((int) $_POST['post_ID']);
331
- if (!isset($_POST['post_title'])) {
332
- $_POST['post_title'] = $content->post_title;
333
- }
334
- if (!isset($_POST['content'])) {
335
- $_POST['content'] = $content->post_content;
336
}
337
- }
338
339
- $b2sPostLang = (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) ? $_POST['b2s-user-lang'] : 'en';
340
- //OgMeta
341
- if (isset($_POST['isOgMetaChecked']) && (int) $_POST['isOgMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
342
- $meta = B2S_Meta::getInstance();
343
- $meta->getMeta(((int) $_POST['post_ID']));
344
- $title = B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang));
345
- if (has_excerpt((int) $_POST['post_ID'])) {
346
- $desc = strip_tags(get_the_excerpt());
347
- } else {
348
- $desc = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($_POST['content'])), 0, 160));
349
}
350
- $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
351
- $meta->setMeta('og_title', $title);
352
- $meta->setMeta('og_desc', $desc);
353
- $meta->setMeta('og_image', (($image_url !== false) ? trim(urldecode($image_url)) : ''));
354
- $meta->updateMeta((int) $_POST['post_ID']);
355
- }
356
357
- //CardMeta
358
- if (isset($_POST['isCardMetaChecked']) && (int) $_POST['isCardMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
359
- $meta = B2S_Meta::getInstance();
360
- $meta->getMeta(((int) $_POST['post_ID']));
361
- $title = B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang));
362
- if (has_excerpt((int) $_POST['post_ID'])) {
363
- $desc = strip_tags(get_the_excerpt());
364
- } else {
365
- $desc = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($_POST['content'])), 0, 160));
366
}
367
- $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
368
- $meta->setMeta('card_title', $title);
369
- $meta->setMeta('card_desc', $desc);
370
- $meta->setMeta('card_image', (($image_url !== false) ? trim(urldecode($image_url)) : ''));
371
- $meta->updateMeta((int) $_POST['post_ID']);
372
- }
373
374
- if (isset($_POST['post_ID']) && isset($_POST['user_ID']) && (int) $_POST['post_ID'] > 0 && (int) $_POST['user_ID'] > 0 && !defined("B2S_SAVE_META_BOX_AUTO_SHARE") && !wp_is_post_autosave($_POST['post_ID']) && isset($_POST['b2s-meta-box-nonce']) && wp_verify_nonce($_POST['b2s-meta-box-nonce'], 'b2s-meta-box-nonce-post-area') && isset($_POST['post_status']) && isset($_POST['b2s-post-meta-box-time-dropdown'])) {
375
- if (strtolower($_POST['b2s-post-meta-box-time-dropdown']) == 'publish') {
376
- if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
377
- $profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
378
- if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
379
- $networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
380
- if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
381
- $user_timezone = isset($_POST['b2s-user-timezone']) ? $_POST['b2s-user-timezone'] : 0;
382
- $current_utc_date = gmdate('Y-m-d H:i:s');
383
- $current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
384
385
//WP User Sched Post + B2S Share NOW FRIST SAVE
386
- $post_date = '';
387
- if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
388
- $post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
389
- }
390
391
//WP User Sched Post + B2S Share NOW SECOND SAVE
392
- if (empty($post_date) && strtolower($_POST['post_status']) == "future") {
393
- if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
394
- $wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
395
- } else {
396
- //V5.0.0 Gutenberg Editor
397
- $wp_user_sched_post_date = get_the_date('d-m-Y', $_POST['post_ID']) . ' ' . get_the_time('H:m:s', $_POST['post_ID']);
398
}
399
- $post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
400
- }
401
402
//ShareNow
403
- $sched_type = 3;
404
- $sched_date = $current_user_date;
405
- $sched_date_utc = date('Y-m-d H:i:s', strtotime("-30 seconds", strtotime($current_utc_date)));
406
- $myTimeSettings = false;
407
408
//allow for User Post Date (Schedule)
409
- if (!empty($post_date) && $current_user_date <= $post_date) {
410
- $sched_type = 2;
411
412
- if (date('i', strtotime($post_date)) <= 30) {
413
- $sched_date = date('Y-m-d H:30:00', strtotime($post_date));
414
- } else {
415
- $sched_date = date('Y-m-d H:00:00', strtotime('+1 hours', strtotime($post_date)));
416
}
417
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
418
- }
419
420
//Schedule post once
421
- if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 1) {
422
- $user_sched_date = (isset($_POST['b2s-post-meta-box-sched-date']) && strtotime($_POST['b2s-post-meta-box-sched-date']) !== false) ? date('Y-m-d H:i:s', strtotime($_POST['b2s-post-meta-box-sched-date'])) : date('Y-m-d H:i:00', current_time('timestamp'));
423
//Check User Schedule Date in past!
424
- if ($user_sched_date >= $sched_date) {
425
- $sched_type = 2;
426
- $sched_date = $user_sched_date;
427
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
428
- }
429
//allow for my Time Settings
430
- if (isset($_POST['b2s-post-meta-box-best-time-settings'])) {
431
- $myTimeSettings = unserialize(stripslashes($_POST['b2s-post-meta-box-best-time-settings']));
432
- if ($myTimeSettings !== false && is_array($myTimeSettings) && isset($myTimeSettings['times'])) { </