Blog2Social: Social Media Auto Post & Scheduler - Version 5.7.0

Version Description

Save your social media posts as drafts

Download this release

Release Info

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

Code changes from version 5.6.1 to 5.7.0

assets/css/b2s/network.css CHANGED
@@ -169,8 +169,8 @@ ul.b2s-network-item-auth-list li:last-child{
169
  font: 18px/1 Arial,sans-serif;
170
  font-weight: 700;
171
  line-height: 30px;
172
- padding: 0 2px
173
- ;min-width: 28px;
174
  text-align: center;
175
  border: 0 !important;
176
  width: 2% !important;
@@ -548,4 +548,59 @@ ul.b2s-network-item-auth-list li:last-child{
548
  }
549
  .b2s-info-character-limit-text{
550
  margin: 0 0 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  }
169
  font: 18px/1 Arial,sans-serif;
170
  font-weight: 700;
171
  line-height: 30px;
172
+ padding: 0 2px !important;
173
+ min-width: 28px;
174
  text-align: center;
175
  border: 0 !important;
176
  width: 2% !important;
548
  }
549
  .b2s-info-character-limit-text{
550
  margin: 0 0 10px;
551
+ }
552
+
553
+ .b2s-edit-template-preview-border-19 {
554
+ padding-top: 15px;
555
+ padding-bottom: 15px;
556
+ border-radius: 3px;
557
+ }
558
+
559
+ .b2s-edit-template-preview-profile-img-19 {
560
+ height: 40px;
561
+ }
562
+
563
+ .b2s-edit-template-preview-profile-name-19 {
564
+ color: #009090;
565
+ font-size: 13px;
566
+ font-weight: 600;
567
+ line-height: 18px;
568
+ }
569
+
570
+ .b2s-edit-template-preview-header-19 {
571
+ padding-top: 15px;
572
+ padding-bottom: 15px;
573
+ border-bottom: 1px solid lightgray;
574
+ margin-bottom: 15px;
575
+ }
576
+
577
+ .b2s-edit-template-preview-like-icons-19 {
578
+ margin-top: 15px;
579
+ width: 120px;
580
+ }
581
+
582
+ .b2s-edit-template-preview-link-meta-box-title-19 {
583
+ color: #009090;
584
+ font-size: 18px;
585
+ font-weight: 400;
586
+ line-height: 22px;
587
+ }
588
+
589
+ .b2s-edit-template-preview-link-meta-box-desc-19 {
590
+ font-size: 13px;
591
+ line-height: 18px;
592
+ }
593
+
594
+ .b2s-edit-template-preview-link-meta-box-domain-19 {
595
+ font-size: 13px;
596
+ line-height: 18px;
597
+ color: gray;
598
+ }
599
+
600
+ .b2s-edit-template-image-preview .b2s-edit-template-preview-image-border-19 {
601
+ padding: 0px;
602
+ }
603
+
604
+ .b2s-edit-template-preview-content-19 {
605
+ margin: 15px 0px;
606
  }
assets/css/b2s/post.draft.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .deleteDraftBtn {
2
+ margin-right: 10px;
3
+ }
assets/css/b2s/ship.css CHANGED
@@ -1,4 +1,4 @@
1
- /** Navbar */
2
  #b2s-wrapper {
3
  padding-right: 0;
4
  -webkit-transition: all 0.5s ease;
@@ -24,10 +24,10 @@
24
  width: 100% !important;
25
  }
26
  .b2s-network-thumb{
27
- width:20% !important;
28
  }
29
  .b2s-network-details{
30
- width: 60% !important;
31
  }
32
  .b2s-network-status{
33
  width: 15% !important;
@@ -50,7 +50,7 @@
50
  }
51
 
52
  .b2s-network-details-legend{
53
- color:#FFFFFF;
54
  text-align: center;
55
  opacity: 0.6;
56
  }
@@ -246,7 +246,7 @@
246
  color: #fff;
247
  font-weight: 400;
248
  text-transform: uppercase;
249
- margin-top:3px;
250
  margin-bottom: 5px;
251
  }
252
 
@@ -277,7 +277,7 @@
277
  float: left;
278
  }
279
  .b2s-post-item-thumb{
280
- width: 5%;
281
  margin-right: 8px;
282
  }
283
 
@@ -312,7 +312,7 @@
312
  }
313
  .b2s-post-item-details p{
314
  font-size: 12px;
315
- margin: 0px 3px;
316
 
317
  }
318
 
@@ -331,7 +331,7 @@
331
 
332
  .b2s-post-item-details-item-message-input-allow-html{
333
  min-height: 200px;
334
- }
335
  .b2s-post-item-message-info{
336
  margin-left:15px !important;
337
  font-weight: 600;
@@ -357,7 +357,7 @@
357
 
358
  .b2s-no-image-area{
359
  margin-left: 15px;
360
- }
361
  .b2s-no-image-area-text{
362
  font-size: 12px;
363
  margin-left: 2px;
@@ -392,7 +392,7 @@
392
  }
393
  .b2s-post-item-details-release-area{
394
  float: left;
395
- width: 100%;
396
  }
397
 
398
  .b2s-post-item-details-release-area-details, .b2s-post-item-relay-area-details{
@@ -400,7 +400,7 @@
400
  width: 100%;
401
  }
402
  .b2s-post-item-details-release-input-daySelect input{
403
- margin-right: 15px;
404
  }
405
 
406
  .b2s-post-item-details-tag-input{
@@ -513,7 +513,7 @@ input[type="checkbox"], input[type="radio"] {
513
  margin:0px 4px 0px 4px;
514
  }
515
  .ad-tag-btn:hover,.remove-tag-btn:hover{
516
- color:#000;
517
  }
518
 
519
  .b2s-post-details{
@@ -663,7 +663,7 @@ input[type="checkbox"], input[type="radio"] {
663
  }
664
 
665
  .xing-url-title{
666
- margin-top: 0px;
667
  margin-bottom: 4px;
668
  font-size: 18px;
669
  font-weight: normal;
@@ -759,17 +759,17 @@ input[type="checkbox"], input[type="radio"] {
759
  margin-right: 5px !important;
760
  }
761
  .b2s-img-required{
762
- border-color: #d9534f !important;
763
  }
764
  .b2s-post-item-details-url-image{
765
  cursor: pointer;
766
  }
767
 
768
- .b2s-user-network-settings-post-format-area label > input{
769
- visibility: hidden;
770
- position: absolute;
771
  }
772
- .b2s-user-network-settings-post-format-area label > input + img{
773
  cursor:pointer;
774
  border:2px solid transparent;
775
  }
@@ -832,4 +832,16 @@ input[type="number"]{
832
 
833
  .b2s-sidebar-menu-item{
834
  font-weight: 600 !important;
835
- }
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** Navbar */
2
  #b2s-wrapper {
3
  padding-right: 0;
4
  -webkit-transition: all 0.5s ease;
24
  width: 100% !important;
25
  }
26
  .b2s-network-thumb{
27
+ width:20% !important;
28
  }
29
  .b2s-network-details{
30
+ width: 60% !important;
31
  }
32
  .b2s-network-status{
33
  width: 15% !important;
50
  }
51
 
52
  .b2s-network-details-legend{
53
+ color:#FFFFFF;
54
  text-align: center;
55
  opacity: 0.6;
56
  }
246
  color: #fff;
247
  font-weight: 400;
248
  text-transform: uppercase;
249
+ margin-top:3px;
250
  margin-bottom: 5px;
251
  }
252
 
277
  float: left;
278
  }
279
  .b2s-post-item-thumb{
280
+ width: 5%;
281
  margin-right: 8px;
282
  }
283
 
312
  }
313
  .b2s-post-item-details p{
314
  font-size: 12px;
315
+ margin: 0px 3px;
316
 
317
  }
318
 
331
 
332
  .b2s-post-item-details-item-message-input-allow-html{
333
  min-height: 200px;
334
+ }
335
  .b2s-post-item-message-info{
336
  margin-left:15px !important;
337
  font-weight: 600;
357
 
358
  .b2s-no-image-area{
359
  margin-left: 15px;
360
+ }
361
  .b2s-no-image-area-text{
362
  font-size: 12px;
363
  margin-left: 2px;
392
  }
393
  .b2s-post-item-details-release-area{
394
  float: left;
395
+ width: 100%;
396
  }
397
 
398
  .b2s-post-item-details-release-area-details, .b2s-post-item-relay-area-details{
400
  width: 100%;
401
  }
402
  .b2s-post-item-details-release-input-daySelect input{
403
+ margin-right: 15px;
404
  }
405
 
406
  .b2s-post-item-details-tag-input{
513
  margin:0px 4px 0px 4px;
514
  }
515
  .ad-tag-btn:hover,.remove-tag-btn:hover{
516
+ color:#000;
517
  }
518
 
519
  .b2s-post-details{
663
  }
664
 
665
  .xing-url-title{
666
+ margin-top: 0px;
667
  margin-bottom: 4px;
668
  font-size: 18px;
669
  font-weight: normal;
759
  margin-right: 5px !important;
760
  }
761
  .b2s-img-required{
762
+ border-color: #d9534f !important;
763
  }
764
  .b2s-post-item-details-url-image{
765
  cursor: pointer;
766
  }
767
 
768
+ .b2s-user-network-settings-post-format-area label > input{
769
+ visibility: hidden;
770
+ position: absolute;
771
  }
772
+ .b2s-user-network-settings-post-format-area label > input + img{
773
  cursor:pointer;
774
  border:2px solid transparent;
775
  }
832
 
833
  .b2s-sidebar-menu-item{
834
  font-weight: 600 !important;
835
+ }
836
+
837
+ .b2s-submit-btn {
838
+ margin-left: 5px;
839
+ }
840
+
841
+ .b2s-loader-btn-ship{
842
+ height: 24px;
843
+ width: 24px;
844
+ margin-top: -10px !important;
845
+ margin-bottom: -6px !important;
846
+ display: none;
847
+ }
assets/css/general.css CHANGED
@@ -7589,4 +7589,12 @@ CSS CheckBOX
7589
 
7590
  .b2s-padding-bottom-5{
7591
  padding-bottom: 5px;
 
 
 
 
 
 
 
 
7592
  }
7589
 
7590
  .b2s-padding-bottom-5{
7591
  padding-bottom: 5px;
7592
+ }
7593
+
7594
+ .b2s-left-border-success {
7595
+ border-left: 4px solid #79B232;
7596
+ }
7597
+
7598
+ .b2s-left-border-danger {
7599
+ border-left: 4px solid #a94442;
7600
  }
assets/images/settings/b2s-post-format-19-1-de.png ADDED
Binary file
assets/images/settings/b2s-post-format-19-1-en.png ADDED
Binary file
assets/images/settings/b2s-post-format-19-2-de.png ADDED
Binary file
assets/images/settings/b2s-post-format-19-2-en.png ADDED
Binary file
assets/images/settings/like-icons-19.png ADDED
Binary file
assets/js/b2s/calendar.js CHANGED
@@ -1,653 +1,693 @@
1
- jQuery.noConflict();
2
-
3
- var curSource = new Array();
4
- curSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=all&filter_status=0';
5
- var newSource = new Array();
6
-
7
- jQuery(document).ready(function () {
8
- jQuery('#b2s_calendar').fullCalendar({
9
- editable: b2s_has_premium,
10
- locale: b2s_calendar_locale,
11
- eventLimit: 2,
12
- timeFormat: 'H:mm',
13
- eventSources: [curSource[0]],
14
- eventRender: function (event, element) {
15
- show = true;
16
- $header = jQuery("<div>").addClass("b2s-calendar-header").attr('data-b2s-id', event.b2s_id);
17
- $isRelayPost = '';
18
- $isCuratedPost = '';
19
- if (event.post_type == 'b2s_ex_post') {
20
- $isCuratedPost = ' (Curated Post)';
21
- }
22
- if (event.relay_primary_post_id > 0) {
23
- $isRelayPost = ' (Retweet)';
24
- }
25
- $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
26
- element.find(".fc-time").after($network_name);
27
- element.html(element.html());
28
- $parent = element.parent();
29
- $header.append(element.find(".fc-content"));
30
- element.append($header);
31
- $body = jQuery("<div>").addClass("b2s-calendar-body");
32
- $body.append(event.avatar);
33
- if (event.status == "error") {
34
- $body.append(jQuery('<i>').addClass('glyphicon glyphicon-warning-sign glyphicon-danger'));
35
- }
36
- $body.append(element.find(".fc-title"));
37
- $body.append(jQuery("<br>"));
38
- var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
39
- $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
40
- $em.append(event.network_name);
41
- $em.append(jQuery("<span>").text(": " + event.profile));
42
- $body.append($em);
43
- element.append($body);
44
- if (event.status != "scheduled") {
45
- event.editable = false;
46
- }
47
- },
48
- dayRender: function (date, element) {
49
- //TODO state to load
50
- if (!jQuery(element[0]).hasClass('fc-past')) {
51
- var date = jQuery(element[0]).attr('data-date');
52
- var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
53
- $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddPost").val() + "</span>").addClass("b2s-calendar-sched-new-post-btn").attr('href', '#');
54
- sel_element.append($header);
55
- }
56
- },
57
- eventDrop: function (event, delta, revertFunc) {
58
- jQuery.ajax({
59
- url: ajaxurl,
60
- type: "POST",
61
- dataType: "json",
62
- cache: false,
63
- data: {
64
- 'action': 'b2s_calendar_move_post',
65
- 'b2s_id': event.b2s_id,
66
- 'user_timezone': event.user_timezone,
67
- 'sched_date': event.start.format(),
68
- 'post_for_relay': event.post_for_relay,
69
- 'post_for_approve': event.post_for_approve,
70
- 'network_type': event.network_type,
71
- 'nework_id': event.network_id
72
- },
73
- success: function (data) {
74
- refreshCalender();
75
- wp.heartbeat.connectNow();
76
- }
77
- });
78
- },
79
- eventAllow: function (dropLocation, draggedEvent) {
80
- return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
81
- },
82
- eventClick: function (calEvent, jsEvent, view) {
83
- if (calEvent.status == "scheduled") {
84
- showEditSchedCalendarPost(calEvent.b2s_id, calEvent.post_id, calEvent.network_auth_id, calEvent.network_type, calEvent.network_id, calEvent.post_format, calEvent.relay_primary_post_id);
85
- } else {
86
- if (calEvent.publish_link != "") {
87
- window.open(calEvent.publish_link, '_blank');
88
- }
89
- }
90
- },
91
- loading: function (bool) {
92
- if (!bool) {
93
- //Routing from Dashboard - loading edit post preview
94
- var rfd = jQuery('#b2s_rfd').val();
95
- if (rfd == 1) {
96
- jQuery('#b2s_rfd').val("0");
97
- jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
98
- }
99
- }
100
- }
101
-
102
- });
103
- jQuery(".b2s-loading-area").hide();
104
- });
105
-
106
-
107
- function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
108
- if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
109
- {
110
- jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
111
- }
112
- b2s_current_post_id = post_id;
113
- jQuery("#b2sPostId").val(post_id);
114
- var $modal = jQuery("<div>");
115
- jQuery.ajax({
116
- url: ajaxurl,
117
- type: "POST",
118
- cache: false,
119
- async: false,
120
- data: {
121
- 'action': 'b2s_get_post_edit_modal',
122
- 'id': b2s_id
123
- },
124
- success: function (data) {
125
- $modal = $modal.html(data);
126
- }
127
- });
128
- jQuery("body").append($modal);
129
- jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
130
- jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
131
- activatePortal(network_auth_id);
132
- initSceditor(network_auth_id);
133
- networkCount(network_auth_id);
134
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
135
- var postFormatText = b2s_calendar_formats;
136
- var isSetPostFormat = false;
137
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
138
- //is set post format => override current condidtions by user settings for this post
139
- if (post_format !== null) {
140
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
141
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
142
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
143
- //edit modal select post format
144
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
145
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"][data-post-format="' + post_format + '"]').addClass('b2s-settings-checked');
146
- } else {
147
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val()]);
148
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val());
149
- }
150
-
151
- //if linkpost then show btn meta tags
152
- var isMetaChecked = false;
153
- if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
154
- isMetaChecked = true;
155
- }
156
- if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
157
- isMetaChecked = true;
158
- }
159
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
160
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
161
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
162
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
163
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
164
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
165
- if (dataMetaType == "og") {
166
- jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
167
- } else {
168
- jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
169
- }
170
-
171
-
172
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
173
- if (network_id == 1 && network_type == 0) {
174
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
175
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
176
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
177
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
178
- }
179
-
180
-
181
- } else {
182
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
183
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
184
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
185
-
186
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
187
- if (network_id == 1 && network_type == 0) {
188
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
189
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
190
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
191
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
192
- }
193
- }
194
-
195
- //Content Curation
196
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
197
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
198
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
199
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
200
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
201
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
202
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
203
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
204
- } else {
205
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
206
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
207
- }
208
- }
209
-
210
- }
211
- var today = new Date();
212
- var dateFormat = "yyyy-mm-dd";
213
- var language = "en";
214
- var showMeridian = true;
215
- if (jQuery('#b2sUserLang').val() == "de") {
216
- dateFormat = "dd.mm.yyyy";
217
- language = "de";
218
- showMeridian = false;
219
- }
220
-
221
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
222
- format: dateFormat,
223
- language: language,
224
- maxViewMode: 2,
225
- todayHighlight: true,
226
- startDate: today,
227
- calendarWeeks: true,
228
- autoclose: true
229
- });
230
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
231
- minuteStep: 15,
232
- appendWidgetTo: 'body',
233
- showSeconds: false,
234
- showMeridian: showMeridian,
235
- defaultTime: 'current',
236
- snapToStep: true
237
- });
238
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
239
- checkSchedDateTime(network_auth_id);
240
- });
241
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
242
- checkSchedDateTime(network_auth_id);
243
- });
244
- init();
245
-
246
- //is relay post?
247
- if (relay_primary_post_id > 0) {
248
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
249
- if (!jQuery(this).hasClass('b2s-input-hidden') && !jQuery(this).hasClass('b2s-modal-close') && !jQuery(this).hasClass('b2s-post-item-details-relay-input-delay') && !jQuery(this).hasClass('b2s-edit-post-delete') && !jQuery(this).hasClass('b2s-edit-post-save-this')) {
250
- jQuery(this).prop("disabled", true);
251
- }
252
- });
253
- }
254
-
255
- if (!b2s_has_premium)
256
- {
257
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
258
- if (!jQuery(this).hasClass('b2s-modal-close')) {
259
- jQuery(this).prop("disabled", true);
260
- }
261
- });
262
- }
263
- }
264
-
265
- jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
266
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
267
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status;
268
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
269
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
270
- curSource[0] = newSource[0];
271
-
272
- jQuery('.b2s-calendar-filter-network-account-list').html("");
273
- jQuery('.b2s-calendar-filter-network-account-list').hide();
274
- if (jQuery(this).val() != 'all') {
275
- jQuery.ajax({
276
- url: ajaxurl,
277
- type: "POST",
278
- dataType: "json",
279
- cache: false,
280
- async: false,
281
- data: {
282
- 'action': 'b2s_get_calendar_filter_network_auth',
283
- 'network_id': jQuery(this).val()
284
- },
285
- success: function (data) {
286
- if (data.result == true) {
287
- jQuery(".b2s-calendar-filter-network-account-list").show();
288
- jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
289
- }
290
- }
291
- });
292
- }
293
- return false;
294
- });
295
-
296
-
297
- jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
298
- var filter_network_details_auth_id = jQuery(this).val();
299
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
300
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
301
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status;
302
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
303
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
304
- curSource[0] = newSource[0];
305
-
306
- return false;
307
-
308
- });
309
-
310
- jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
311
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
312
- var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
313
- if (typeof filter_network_details_auth_id == 'undefined') {
314
- filter_network_details_auth_id = 'all';
315
- }
316
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
317
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status;
318
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
319
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
320
- curSource[0] = newSource[0];
321
-
322
- return false;
323
-
324
- });
325
-
326
-
327
- //Modal Edit Post close
328
- jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
329
- jQuery(jQuery(this).attr('data-modal-name')).remove();
330
- return false;
331
- });
332
-
333
-
334
- jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
335
- jQuery('#b2sPagination').val("1");
336
- b2sSortFormSubmit();
337
- return false;
338
- });
339
-
340
- jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
341
- if (event.keyCode == 13) { //Hide Enter
342
- return false;
343
- }
344
- });
345
-
346
- jQuery(document).on('click', '.b2s-pagination-btn', function () {
347
- jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
348
- b2sSortFormSubmit();
349
- return false;
350
- });
351
-
352
- jQuery(document).on('change', '.b2s-select', function () {
353
- jQuery('#b2sPagination').val("1");
354
- b2sSortFormSubmit();
355
- return false;
356
- });
357
-
358
- jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
359
- jQuery('#b2sPagination').val("1");
360
- jQuery('#b2sSortPostTitle').val("");
361
- jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
362
- jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
363
- jQuery('#b2sSortPostType').prop('selectedIndex', 0);
364
- jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
365
- jQuery('#b2sShowByDate').val("");
366
- jQuery('#b2sUserAuthId').val("");
367
- jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
368
- jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
369
- b2sSortFormSubmit();
370
- return false;
371
- });
372
-
373
- jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
374
- if (jQuery('#user_version').val() == 0) {
375
- jQuery('#b2s-sched-post-modal').modal('show');
376
- return false;
377
- }
378
- jQuery('#b2s-show-post-type-modal').modal('show');
379
- var selSchedDate = jQuery(this).parent('td').attr('data-date');
380
- jQuery('#b2sSelSchedDate').val(selSchedDate);
381
- return false;
382
- });
383
-
384
- jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
385
- jQuery('#b2s-show-post-type-modal').modal('hide');
386
- jQuery('#b2s-show-post-all-modal').modal('show');
387
- if (!jQuery('#b2sSelSchedDate').length > 0) {
388
- jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
389
- }
390
- b2sSortFormSubmit();
391
- return false;
392
- });
393
-
394
- jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
395
- window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
396
- return false;
397
- });
398
-
399
- function showFilter(typ) {
400
- if (typ == 'show') {
401
- jQuery('.filterShow').hide();
402
- jQuery('.form-inline').show();
403
- jQuery('.filterHide').show();
404
- } else {
405
- jQuery('.filterShow').show();
406
- jQuery('.form-inline').hide();
407
- jQuery('.filterHide').hide();
408
- }
409
- }
410
-
411
- //b2sSortForm
412
- function b2sSortFormSubmit() {
413
- jQuery(".b2s-loading-area").show();
414
- jQuery('.b2s-sort-result-item-area').html('');
415
- jQuery('.b2s-sort-pagination-area').html('');
416
-
417
- var data = {
418
- 'action': 'b2s_sort_data',
419
- 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
420
- 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
421
- 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
422
- 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
423
- 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
424
- 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
425
- 'b2sType': jQuery('#b2sType').val(),
426
- 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
427
- 'b2sPagination': jQuery('#b2sPagination').val(),
428
- 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
429
- 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
430
- 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
431
- 'b2sUserLang': jQuery('#b2sUserLang').val(),
432
- 'b2sSchedDate': jQuery('#b2sSelSchedDate').val()
433
- };
434
-
435
- if (jQuery('#b2sPostsPerPage').length > 0) {
436
- data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
437
- }
438
-
439
- jQuery.ajax({
440
- url: ajaxurl,
441
- type: "POST",
442
- dataType: "json",
443
- cache: false,
444
- data: data,
445
- error: function () {
446
- jQuery('.b2s-server-connection-fail').show();
447
- return false;
448
- },
449
- success: function (data) {
450
- if (typeof data === 'undefined' || data === null) {
451
- jQuery('.b2s-server-connection-fail').show();
452
- return false;
453
- }
454
- if (data.result == true) {
455
- jQuery('.b2s-loading-area').hide();
456
- jQuery('.b2s-sort-result-item-area').html(data.content).show();
457
- jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
458
- } else {
459
- jQuery('.b2s-server-connection-fail').show();
460
- return false;
461
- }
462
- }
463
- });
464
- return false;
465
- }
466
- //Overlay second modal
467
- jQuery('#b2s-show-post-type-modal').on('hidden.bs.modal', function () {
468
- jQuery('body').addClass('modal-open');
469
- });
470
-
471
- //Overlay second modal
472
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
473
- jQuery('body').addClass('modal-open');
474
- });
475
-
476
- //Overlay second modal
477
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
478
- jQuery('body').addClass('modal-open');
479
- });
480
-
481
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
482
- jQuery('.b2s-network-select-image-content').html("");
483
- jQuery.ajax({
484
- url: ajaxurl,
485
- type: "POST",
486
- cache: false,
487
- async: false,
488
- data: {
489
- 'action': 'b2s_get_image_modal',
490
- 'id': jQuery(this).data('post-id'),
491
- 'image_url': jQuery(this).data('image-url')
492
- },
493
- success: function (data) {
494
- jQuery(".b2s-network-select-image-content").html(data);
495
- }
496
- });
497
- var authId = jQuery(this).data('network-auth-id');
498
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
499
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
500
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
501
- jQuery('.b2s-selected-network-for-image-info').html(content);
502
- jQuery('#b2sInsertImageType').val("0");
503
- jQuery('.networkImage').each(function () {
504
- var width = this.naturalWidth;
505
- var height = this.naturalHeight;
506
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
507
- });
508
- jQuery('#b2s-network-select-image').modal('show');
509
- return false;
510
- });
511
- jQuery(document).on("click", ".b2s-edit-post-delete", function () {
512
- var id = jQuery(this).data("b2s-id");
513
- var post_id = jQuery(this).data("post-id");
514
- var post_for_relay = jQuery(this).data("data-post-for-relay");
515
- var post_for_approve = jQuery(this).data("data-post-for-approve");
516
- jQuery.ajax({
517
- url: ajaxurl,
518
- type: "POST",
519
- dataType: "json",
520
- cache: false,
521
- data: {
522
- 'action': 'b2s_delete_post',
523
- 'b2s_id': id,
524
- 'post_id': post_id,
525
- 'post_for_relay': post_for_relay,
526
- 'post_for_approve': post_for_approve
527
- },
528
- success: function (data) {
529
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
530
- refreshCalender();
531
- wp.heartbeat.connectNow();
532
- }
533
- });
534
- });
535
-
536
- /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
537
- jQuery('#save_method').val("apply-all");
538
- e.preventDefault();
539
- var id = jQuery(this).data("b2s-id");
540
- jQuery.ajax({
541
- url: ajaxurl,
542
- type: "POST",
543
- dataType: "json",
544
- cache: false,
545
- data: jQuery(this).closest("form").serialize(),
546
- success: function (data) {
547
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
548
- refreshCalender();
549
- jQuery('#b2s-edit-event-modal-' + id).remove();
550
- wp.heartbeat.connectNow();
551
- }
552
- });
553
- });*/
554
-
555
- jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
556
- e.preventDefault();
557
- jQuery('#save_method').val("apply-this");
558
- var id = jQuery(this).data("b2s-id");
559
- jQuery.ajax({
560
- url: ajaxurl,
561
- type: "POST",
562
- dataType: "json",
563
- cache: false,
564
- data: jQuery(this).closest("form").serialize(),
565
- success: function (data) {
566
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
567
- refreshCalender();
568
- jQuery('#b2s-edit-event-modal-' + id).remove();
569
- jQuery('body').removeClass('modal-open');
570
- jQuery('body').removeAttr('style');
571
- wp.heartbeat.connectNow();
572
- }
573
- });
574
- });
575
- jQuery(document).on("click", ".release_locks", function () {
576
- jQuery.ajax({
577
- url: ajaxurl,
578
- type: "POST",
579
- cache: false,
580
- async: false,
581
- data: {
582
- 'action': 'b2s_get_calendar_release_locks',
583
- 'post_id': jQuery('#post_id').val()
584
- },
585
- success: function (data) {
586
- wp.heartbeat.connectNow();
587
- }
588
- });
589
- });
590
- function refreshCalender() {
591
- jQuery('#b2s_calendar').fullCalendar('refetchEvents');
592
- }
593
-
594
- jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
595
- jQuery('body').addClass('modal-open');
596
- });
597
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
598
- jQuery('body').addClass('modal-open');
599
- });
600
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
601
- jQuery('body').addClass('modal-open');
602
- });
603
- jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
604
- jQuery('body').addClass('modal-open');
605
- });
606
- //jQuery(this).attr('data-network-auth-id')
607
- function checkSchedDateTime(dataNetworkAuthId) {
608
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
609
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
610
- var dateStr = jQuery(dateElement).val();
611
- var minStr = jQuery(timeElement).val();
612
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
613
- if (jQuery('#b2sUserLang').val() == 'de') {
614
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
615
- } else {
616
- var minParts = minStr.split(' ');
617
- var minParts2 = minParts[0].split(':');
618
- if (minParts[1] == 'PM') {
619
- minParts2[0] = parseInt(minParts2[0]) + 12;
620
- }
621
- minStr = minParts2[0] + ':' + minParts2[1];
622
- }
623
-
624
- var minParts3 = minStr.split(':');
625
- if (minParts3[0] < 10) {
626
- minParts3[0] = '0' + minParts3[0];
627
- }
628
- var dateParts = dateStr.split('-');
629
- //utc current time
630
- var now = new Date();
631
- //offset between utc und user
632
- var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
633
- //enter hour to user time
634
- var hour = parseInt(minParts3[0]) + timeZone + offset;
635
- //calculate datetime in utc
636
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
637
- //compare enter date time with allowed user time
638
- if (enter.getTime() < now.getTime()) {
639
- //enter set on next 15 minutes and calculate on user timezone
640
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
641
- jQuery(dateElement).datepicker('update', enter);
642
- jQuery(timeElement).timepicker('setTime', enter);
643
- }
644
- }
645
-
646
-
647
- function printDateFormat(dataNetworkAuthId) {
648
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
649
- var dateStr = jQuery(dateElement).val();
650
- dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
651
- jQuery(dateElement).val(dateStr);
652
- }
653
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+ var curSource = new Array();
4
+ curSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=all&filter_status=0';
5
+ var newSource = new Array();
6
+
7
+ jQuery(document).ready(function () {
8
+ jQuery('#b2s_calendar').fullCalendar({
9
+ editable: b2s_has_premium,
10
+ locale: b2s_calendar_locale,
11
+ eventLimit: 2,
12
+ timeFormat: 'H:mm',
13
+ eventSources: [curSource[0]],
14
+ eventRender: function (event, element) {
15
+ show = true;
16
+ $header = jQuery("<div>").addClass("b2s-calendar-header").attr('data-b2s-id', event.b2s_id);
17
+ $isRelayPost = '';
18
+ $isCuratedPost = '';
19
+ if (event.post_type == 'b2s_ex_post') {
20
+ $isCuratedPost = ' (Curated Post)';
21
+ }
22
+ if (event.relay_primary_post_id > 0) {
23
+ $isRelayPost = ' (Retweet)';
24
+ }
25
+ $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
26
+ element.find(".fc-time").after($network_name);
27
+ element.html(element.html());
28
+ $parent = element.parent();
29
+ $header.append(element.find(".fc-content"));
30
+ element.append($header);
31
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
32
+ $body.append(event.avatar);
33
+ if (event.status == "error") {
34
+ $body.append(jQuery('<i>').addClass('glyphicon glyphicon-warning-sign glyphicon-danger'));
35
+ }
36
+ $body.append(element.find(".fc-title"));
37
+ $body.append(jQuery("<br>"));
38
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
39
+ $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
40
+ $em.append(event.network_name);
41
+ $em.append(jQuery("<span>").text(": " + event.profile));
42
+ $body.append($em);
43
+ element.append($body);
44
+ if (event.status != "scheduled") {
45
+ event.editable = false;
46
+ }
47
+ },
48
+ dayRender: function (date, element) {
49
+ //TODO state to load
50
+ if (!jQuery(element[0]).hasClass('fc-past')) {
51
+ var date = jQuery(element[0]).attr('data-date');
52
+ var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
53
+ $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddPost").val() + "</span>").addClass("b2s-calendar-sched-new-post-btn").attr('href', '#');
54
+ sel_element.append($header);
55
+ }
56
+ },
57
+ eventDrop: function (event, delta, revertFunc) {
58
+ jQuery.ajax({
59
+ url: ajaxurl,
60
+ type: "POST",
61
+ dataType: "json",
62
+ cache: false,
63
+ data: {
64
+ 'action': 'b2s_calendar_move_post',
65
+ 'b2s_id': event.b2s_id,
66
+ 'user_timezone': event.user_timezone,
67
+ 'sched_date': event.start.format(),
68
+ 'post_for_relay': event.post_for_relay,
69
+ 'post_for_approve': event.post_for_approve,
70
+ 'network_type': event.network_type,
71
+ 'nework_id': event.network_id
72
+ },
73
+ success: function (data) {
74
+ refreshCalender();
75
+ wp.heartbeat.connectNow();
76
+ }
77
+ });
78
+ },
79
+ eventAllow: function (dropLocation, draggedEvent) {
80
+ return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
81
+ },
82
+ eventClick: function (calEvent, jsEvent, view) {
83
+ if (calEvent.status == "scheduled") {
84
+ showEditSchedCalendarPost(calEvent.b2s_id, calEvent.post_id, calEvent.network_auth_id, calEvent.network_type, calEvent.network_id, calEvent.post_format, calEvent.relay_primary_post_id);
85
+ } else {
86
+ if (calEvent.publish_link != "") {
87
+ window.open(calEvent.publish_link, '_blank');
88
+ }
89
+ }
90
+ },
91
+ loading: function (bool) {
92
+ if (!bool) {
93
+ //Routing from Dashboard - loading edit post preview
94
+ var rfd = jQuery('#b2s_rfd').val();
95
+ if (rfd == 1) {
96
+ jQuery('#b2s_rfd').val("0");
97
+ jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
98
+ }
99
+ }
100
+ }
101
+
102
+ });
103
+ jQuery(".b2s-loading-area").hide();
104
+ });
105
+
106
+
107
+ function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
108
+ if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
109
+ {
110
+ jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
111
+ }
112
+ b2s_current_post_id = post_id;
113
+ jQuery("#b2sPostId").val(post_id);
114
+ var $modal = jQuery("<div>");
115
+ jQuery.ajax({
116
+ url: ajaxurl,
117
+ type: "POST",
118
+ cache: false,
119
+ async: false,
120
+ data: {
121
+ 'action': 'b2s_get_post_edit_modal',
122
+ 'id': b2s_id
123
+ },
124
+ success: function (data) {
125
+ $modal = $modal.html(data);
126
+ }
127
+ });
128
+ jQuery("body").append($modal);
129
+ jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
130
+ jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
131
+ activatePortal(network_auth_id);
132
+ initSceditor(network_auth_id);
133
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
134
+ var postFormatText = b2s_calendar_formats;
135
+ var isSetPostFormat = false;
136
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
137
+ //is set post format => override current condidtions by user settings for this post
138
+ if (post_format !== null) {
139
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
140
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
141
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
142
+ //edit modal select post format
143
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
144
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"][data-post-format="' + post_format + '"]').addClass('b2s-settings-checked');
145
+ } else {
146
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val()]);
147
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val());
148
+ }
149
+
150
+ //if linkpost then show btn meta tags
151
+ var isMetaChecked = false;
152
+ if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
153
+ isMetaChecked = true;
154
+ }
155
+ if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
156
+ isMetaChecked = true;
157
+ }
158
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
159
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
160
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
161
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
162
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
163
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
164
+ if (dataMetaType == "og") {
165
+ jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
166
+ } else {
167
+ jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
168
+ }
169
+
170
+
171
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
172
+ if (network_id == 1 && network_type == 0) {
173
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
174
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
175
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
176
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
177
+ }
178
+
179
+
180
+ } else {
181
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
182
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
183
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
184
+
185
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
186
+ if (network_id == 1 && network_type == 0) {
187
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
188
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
189
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
190
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
191
+ }
192
+ }
193
+
194
+ //Content Curation
195
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
196
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
197
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
198
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
199
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
200
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
201
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
202
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
203
+ } else {
204
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
205
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
206
+ }
207
+ }
208
+
209
+
210
+ if (network_id == "3") {
211
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
212
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').show();
213
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').trigger("click");
214
+ jQuery('.linkedin-url-title[data-network-auth-id="' + network_auth_id + '"]').show();
215
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide(); //not showing on linkedin
216
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
217
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
218
+ } else {
219
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').hide();
220
+ jQuery('.linkedin-url-title[data-network-auth-id="' + network_auth_id + '"]').hide();
221
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide();
222
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
223
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
224
+ }
225
+ }
226
+
227
+ if (network_id == "19" && network_type == "0") {
228
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
229
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').show();
230
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').trigger("click");
231
+ jQuery('.xing-url-title[data-network-auth-id="' + network_auth_id + '"]').show();
232
+ jQuery('.xing-url-desc[data-network-auth-id="' + network_auth_id + '"]').show();
233
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
234
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
235
+ } else {
236
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').hide();
237
+ jQuery('.xing-url-title[data-network-auth-id="' + network_auth_id + '"]').hide();
238
+ jQuery('.xing-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide();
239
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
240
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
241
+ }
242
+ }
243
+
244
+ }
245
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + network_auth_id + '"]').attr('data-network-text-limit');
246
+ if (textLimit != "0") {
247
+ networkLimitAll(network_auth_id, network_id, textLimit);
248
+ } else {
249
+ networkCount(network_auth_id);
250
+ }
251
+ var today = new Date();
252
+ var dateFormat = "yyyy-mm-dd";
253
+ var language = "en";
254
+ var showMeridian = true;
255
+ if (jQuery('#b2sUserLang').val() == "de") {
256
+ dateFormat = "dd.mm.yyyy";
257
+ language = "de";
258
+ showMeridian = false;
259
+ }
260
+
261
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
262
+ format: dateFormat,
263
+ language: language,
264
+ maxViewMode: 2,
265
+ todayHighlight: true,
266
+ startDate: today,
267
+ calendarWeeks: true,
268
+ autoclose: true
269
+ });
270
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
271
+ minuteStep: 15,
272
+ appendWidgetTo: 'body',
273
+ showSeconds: false,
274
+ showMeridian: showMeridian,
275
+ defaultTime: 'current',
276
+ snapToStep: true
277
+ });
278
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
279
+ checkSchedDateTime(network_auth_id);
280
+ });
281
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
282
+ checkSchedDateTime(network_auth_id);
283
+ });
284
+ init();
285
+
286
+ //is relay post?
287
+ if (relay_primary_post_id > 0) {
288
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
289
+ if (!jQuery(this).hasClass('b2s-input-hidden') && !jQuery(this).hasClass('b2s-modal-close') && !jQuery(this).hasClass('b2s-post-item-details-relay-input-delay') && !jQuery(this).hasClass('b2s-edit-post-delete') && !jQuery(this).hasClass('b2s-edit-post-save-this')) {
290
+ jQuery(this).prop("disabled", true);
291
+ }
292
+ });
293
+ }
294
+
295
+ if (!b2s_has_premium)
296
+ {
297
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
298
+ if (!jQuery(this).hasClass('b2s-modal-close')) {
299
+ jQuery(this).prop("disabled", true);
300
+ }
301
+ });
302
+ }
303
+ }
304
+
305
+ jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
306
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
307
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status;
308
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
309
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
310
+ curSource[0] = newSource[0];
311
+
312
+ jQuery('.b2s-calendar-filter-network-account-list').html("");
313
+ jQuery('.b2s-calendar-filter-network-account-list').hide();
314
+ if (jQuery(this).val() != 'all') {
315
+ jQuery.ajax({
316
+ url: ajaxurl,
317
+ type: "POST",
318
+ dataType: "json",
319
+ cache: false,
320
+ async: false,
321
+ data: {
322
+ 'action': 'b2s_get_calendar_filter_network_auth',
323
+ 'network_id': jQuery(this).val()
324
+ },
325
+ success: function (data) {
326
+ if (data.result == true) {
327
+ jQuery(".b2s-calendar-filter-network-account-list").show();
328
+ jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
329
+ }
330
+ }
331
+ });
332
+ }
333
+ return false;
334
+ });
335
+
336
+
337
+ jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
338
+ var filter_network_details_auth_id = jQuery(this).val();
339
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
340
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
341
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status;
342
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
343
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
344
+ curSource[0] = newSource[0];
345
+
346
+ return false;
347
+
348
+ });
349
+
350
+ jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
351
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
352
+ var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
353
+ if (typeof filter_network_details_auth_id == 'undefined') {
354
+ filter_network_details_auth_id = 'all';
355
+ }
356
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
357
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status;
358
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
359
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
360
+ curSource[0] = newSource[0];
361
+
362
+ return false;
363
+
364
+ });
365
+
366
+
367
+ //Modal Edit Post close
368
+ jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
369
+ jQuery(jQuery(this).attr('data-modal-name')).remove();
370
+ return false;
371
+ });
372
+
373
+
374
+ jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
375
+ jQuery('#b2sPagination').val("1");
376
+ b2sSortFormSubmit();
377
+ return false;
378
+ });
379
+
380
+ jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
381
+ if (event.keyCode == 13) { //Hide Enter
382
+ return false;
383
+ }
384
+ });
385
+
386
+ jQuery(document).on('click', '.b2s-pagination-btn', function () {
387
+ jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
388
+ b2sSortFormSubmit();
389
+ return false;
390
+ });
391
+
392
+ jQuery(document).on('change', '.b2s-select', function () {
393
+ jQuery('#b2sPagination').val("1");
394
+ b2sSortFormSubmit();
395
+ return false;
396
+ });
397
+
398
+ jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
399
+ jQuery('#b2sPagination').val("1");
400
+ jQuery('#b2sSortPostTitle').val("");
401
+ jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
402
+ jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
403
+ jQuery('#b2sSortPostType').prop('selectedIndex', 0);
404
+ jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
405
+ jQuery('#b2sShowByDate').val("");
406
+ jQuery('#b2sUserAuthId').val("");
407
+ jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
408
+ jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
409
+ b2sSortFormSubmit();
410
+ return false;
411
+ });
412
+
413
+ jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
414
+ if (jQuery('#user_version').val() == 0) {
415
+ jQuery('#b2s-sched-post-modal').modal('show');
416
+ return false;
417
+ }
418
+ jQuery('#b2s-show-post-type-modal').modal('show');
419
+ var selSchedDate = jQuery(this).parent('td').attr('data-date');
420
+ jQuery('#b2sSelSchedDate').val(selSchedDate);
421
+ return false;
422
+ });
423
+
424
+ jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
425
+ jQuery('#b2s-show-post-type-modal').modal('hide');
426
+ jQuery('#b2s-show-post-all-modal').modal('show');
427
+ if (!jQuery('#b2sSelSchedDate').length > 0) {
428
+ jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
429
+ }
430
+ b2sSortFormSubmit();
431
+ return false;
432
+ });
433
+
434
+ jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
435
+ window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
436
+ return false;
437
+ });
438
+
439
+ function showFilter(typ) {
440
+ if (typ == 'show') {
441
+ jQuery('.filterShow').hide();
442
+ jQuery('.form-inline').show();
443
+ jQuery('.filterHide').show();
444
+ } else {
445
+ jQuery('.filterShow').show();
446
+ jQuery('.form-inline').hide();
447
+ jQuery('.filterHide').hide();
448
+ }
449
+ }
450
+
451
+ //b2sSortForm
452
+ function b2sSortFormSubmit() {
453
+ jQuery(".b2s-loading-area").show();
454
+ jQuery('.b2s-sort-result-item-area').html('');
455
+ jQuery('.b2s-sort-pagination-area').html('');
456
+
457
+ var data = {
458
+ 'action': 'b2s_sort_data',
459
+ 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
460
+ 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
461
+ 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
462
+ 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
463
+ 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
464
+ 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
465
+ 'b2sType': jQuery('#b2sType').val(),
466
+ 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
467
+ 'b2sPagination': jQuery('#b2sPagination').val(),
468
+ 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
469
+ 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
470
+ 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
471
+ 'b2sUserLang': jQuery('#b2sUserLang').val(),
472
+ 'b2sSchedDate': jQuery('#b2sSelSchedDate').val()
473
+ };
474
+
475
+ if (jQuery('#b2sPostsPerPage').length > 0) {
476
+ data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
477
+ }
478
+
479
+ jQuery.ajax({
480
+ url: ajaxurl,
481
+ type: "POST",
482
+ dataType: "json",
483
+ cache: false,
484
+ data: data,
485
+ error: function () {
486
+ jQuery('.b2s-server-connection-fail').show();
487
+ return false;
488
+ },
489
+ success: function (data) {
490
+ if (typeof data === 'undefined' || data === null) {
491
+ jQuery('.b2s-server-connection-fail').show();
492
+ return false;
493
+ }
494
+ if (data.result == true) {
495
+ jQuery('.b2s-loading-area').hide();
496
+ jQuery('.b2s-sort-result-item-area').html(data.content).show();
497
+ jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
498
+ } else {
499
+ jQuery('.b2s-server-connection-fail').show();
500
+ return false;
501
+ }
502
+ }
503
+ });
504
+ return false;
505
+ }
506
+ //Overlay second modal
507
+ jQuery('#b2s-show-post-type-modal').on('hidden.bs.modal', function () {
508
+ jQuery('body').addClass('modal-open');
509
+ });
510
+
511
+ //Overlay second modal
512
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
513
+ jQuery('body').addClass('modal-open');
514
+ });
515
+
516
+ //Overlay second modal
517
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
518
+ jQuery('body').addClass('modal-open');
519
+ });
520
+
521
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
522
+ jQuery('.b2s-network-select-image-content').html("");
523
+ jQuery.ajax({
524
+ url: ajaxurl,
525
+ type: "POST",
526
+ cache: false,
527
+ async: false,
528
+ data: {
529
+ 'action': 'b2s_get_image_modal',
530
+ 'id': jQuery(this).data('post-id'),
531
+ 'image_url': jQuery(this).data('image-url')
532
+ },
533
+ success: function (data) {
534
+ jQuery(".b2s-network-select-image-content").html(data);
535
+ }
536
+ });
537
+ var authId = jQuery(this).data('network-auth-id');
538
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
539
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
540
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
541
+ jQuery('.b2s-selected-network-for-image-info').html(content);
542
+ jQuery('#b2sInsertImageType').val("0");
543
+ jQuery('.networkImage').each(function () {
544
+ var width = this.naturalWidth;
545
+ var height = this.naturalHeight;
546
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
547
+ });
548
+ jQuery('#b2s-network-select-image').modal('show');
549
+ return false;
550
+ });
551
+ jQuery(document).on("click", ".b2s-edit-post-delete", function () {
552
+ var id = jQuery(this).data("b2s-id");
553
+ var post_id = jQuery(this).data("post-id");
554
+ var post_for_relay = jQuery(this).data("data-post-for-relay");
555
+ var post_for_approve = jQuery(this).data("data-post-for-approve");
556
+ jQuery.ajax({
557
+ url: ajaxurl,
558
+ type: "POST",
559
+ dataType: "json",
560
+ cache: false,
561
+ data: {
562
+ 'action': 'b2s_delete_post',
563
+ 'b2s_id': id,
564
+ 'post_id': post_id,
565
+ 'post_for_relay': post_for_relay,
566
+ 'post_for_approve': post_for_approve
567
+ },
568
+ success: function (data) {
569
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
570
+ refreshCalender();
571
+ wp.heartbeat.connectNow();
572
+ }
573
+ });
574
+ });
575
+
576
+ /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
577
+ jQuery('#save_method').val("apply-all");
578
+ e.preventDefault();
579
+ var id = jQuery(this).data("b2s-id");
580
+ jQuery.ajax({
581
+ url: ajaxurl,
582
+ type: "POST",
583
+ dataType: "json",
584
+ cache: false,
585
+ data: jQuery(this).closest("form").serialize(),
586
+ success: function (data) {
587
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
588
+ refreshCalender();
589
+ jQuery('#b2s-edit-event-modal-' + id).remove();
590
+ wp.heartbeat.connectNow();
591
+ }
592
+ });
593
+ });*/
594
+
595
+ jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
596
+ e.preventDefault();
597
+ jQuery('#save_method').val("apply-this");
598
+ var id = jQuery(this).data("b2s-id");
599
+ jQuery.ajax({
600
+ url: ajaxurl,
601
+ type: "POST",
602
+ dataType: "json",
603
+ cache: false,
604
+ data: jQuery(this).closest("form").serialize(),
605
+ success: function (data) {
606
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
607
+ refreshCalender();
608
+ jQuery('#b2s-edit-event-modal-' + id).remove();
609
+ jQuery('body').removeClass('modal-open');
610
+ jQuery('body').removeAttr('style');
611
+ wp.heartbeat.connectNow();
612
+ }
613
+ });
614
+ });
615
+ jQuery(document).on("click", ".release_locks", function () {
616
+ jQuery.ajax({
617
+ url: ajaxurl,
618
+ type: "POST",
619
+ cache: false,
620
+ async: false,
621
+ data: {
622
+ 'action': 'b2s_get_calendar_release_locks',
623
+ 'post_id': jQuery('#post_id').val()
624
+ },
625
+ success: function (data) {
626
+ wp.heartbeat.connectNow();
627
+ }
628
+ });
629
+ });
630
+ function refreshCalender() {
631
+ jQuery('#b2s_calendar').fullCalendar('refetchEvents');
632
+ }
633
+
634
+ jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
635
+ jQuery('body').addClass('modal-open');
636
+ });
637
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
638
+ jQuery('body').addClass('modal-open');
639
+ });
640
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
641
+ jQuery('body').addClass('modal-open');
642
+ });
643
+ jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
644
+ jQuery('body').addClass('modal-open');
645
+ });
646
+ //jQuery(this).attr('data-network-auth-id')
647
+ function checkSchedDateTime(dataNetworkAuthId) {
648
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
649
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
650
+ var dateStr = jQuery(dateElement).val();
651
+ var minStr = jQuery(timeElement).val();
652
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
653
+ if (jQuery('#b2sUserLang').val() == 'de') {
654
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
655
+ } else {
656
+ var minParts = minStr.split(' ');
657
+ var minParts2 = minParts[0].split(':');
658
+ if (minParts[1] == 'PM') {
659
+ minParts2[0] = parseInt(minParts2[0]) + 12;
660
+ }
661
+ minStr = minParts2[0] + ':' + minParts2[1];
662
+ }
663
+
664
+ var minParts3 = minStr.split(':');
665
+ if (minParts3[0] < 10) {
666
+ minParts3[0] = '0' + minParts3[0];
667
+ }
668
+ var dateParts = dateStr.split('-');
669
+ //utc current time
670
+ var now = new Date();
671
+ //offset between utc und user
672
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
673
+ //enter hour to user time
674
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
675
+ //calculate datetime in utc
676
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
677
+ //compare enter date time with allowed user time
678
+ if (enter.getTime() < now.getTime()) {
679
+ //enter set on next 15 minutes and calculate on user timezone
680
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
681
+ jQuery(dateElement).datepicker('update', enter);
682
+ jQuery(timeElement).timepicker('setTime', enter);
683
+ }
684
+ }
685
+
686
+
687
+ function printDateFormat(dataNetworkAuthId) {
688
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
689
+ var dateStr = jQuery(dateElement).val();
690
+ dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
691
+ jQuery(dateElement).val(dateStr);
692
+ }
693
+
assets/js/b2s/curation.draft.js CHANGED
@@ -84,6 +84,57 @@ function b2sSortFormSubmit() {
84
  });
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
88
  jQuery('#b2sPagination').val("1");
89
  jQuery('#b2sSortPostTitle').val("");
84
  });
85
  }
86
 
87
+ jQuery(document).on('click', '.deleteCcDraftBtn', function () {
88
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-blog-post-id'));
89
+ jQuery('.b2s-delete-cc-draft-modal').modal('show');
90
+ jQuery('.b2s-delete-cc-draft-confirm-btn').prop('disabeld', false);
91
+
92
+ });
93
+
94
+ jQuery(document).on('click', '.b2s-delete-cc-draft-confirm-btn', function () {
95
+ jQuery('.b2s-post-remove-fail').hide();
96
+ jQuery('.b2s-post-remove-success').hide();
97
+ jQuery('.b2s-delete-cc-draft-confirm-btn').prop('disabeld', true);
98
+ jQuery('.b2s-server-connection-fail').hide();
99
+ jQuery.ajax({
100
+ url: ajaxurl,
101
+ type: "POST",
102
+ dataType: "json",
103
+ cache: false,
104
+ data: {
105
+ 'action': 'b2s_delete_user_cc_draft_post',
106
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val()
107
+ },
108
+ error: function () {
109
+ jQuery('.b2s-server-connection-fail').show();
110
+ return false;
111
+ },
112
+ success: function (data) {
113
+ jQuery('.b2s-delete-cc-draft-modal').modal('hide');
114
+ if (data.result == true) {
115
+ jQuery('.b2s-list-cc-draft[data-blog-post-id="'+data.postId+'"').remove();
116
+ /*var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html());
117
+ var newCount = count - data.postCount;
118
+ jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
119
+ if (newCount >= 1) {
120
+ jQuery.each(data.postId, function (i, id) {
121
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + id + '"]').remove();
122
+ });
123
+ } else {
124
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
125
+ }*/
126
+ jQuery('.b2s-post-remove-success').show();
127
+ } else {
128
+ jQuery('.b2s-post-remove-fail').show();
129
+ }
130
+
131
+ return true;
132
+ }
133
+ });
134
+ });
135
+
136
+
137
+
138
  jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
139
  jQuery('#b2sPagination').val("1");
140
  jQuery('#b2sSortPostTitle').val("");
assets/js/b2s/general.js CHANGED
@@ -319,3 +319,6 @@ jQuery(document).on("click", ".b2s-scroll-modal-down", function (e) {
319
  return false;
320
  });
321
 
 
 
 
319
  return false;
320
  });
321
 
322
+ jQuery(document).on('click', '.b2s-network-auth-info-close', function() {
323
+ jQuery(this).closest('.b2s-network-auth-info').hide();
324
+ });
assets/js/b2s/network.js CHANGED
@@ -1025,6 +1025,7 @@ jQuery(window).on("load", function () {
1025
  var newText = text.slice(0, start) + jQuery(this).html() + text.slice(end);
1026
  jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val(newText);
1027
  jQuery('.b2s-edit-template-post-content').focus();
 
1028
  event.preventDefault();
1029
  return false;
1030
  });
@@ -1033,6 +1034,7 @@ jQuery(window).on("load", function () {
1033
  var networkType = jQuery(this).attr('data-network-type');
1034
  jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val("");
1035
  jQuery('.b2s-edit-template-post-content').focus();
 
1036
  event.preventDefault();
1037
  return false;
1038
  });
1025
  var newText = text.slice(0, start) + jQuery(this).html() + text.slice(end);
1026
  jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val(newText);
1027
  jQuery('.b2s-edit-template-post-content').focus();
1028
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
1029
  event.preventDefault();
1030
  return false;
1031
  });
1034
  var networkType = jQuery(this).attr('data-network-type');
1035
  jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val("");
1036
  jQuery('.b2s-edit-template-post-content').focus();
1037
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
1038
  event.preventDefault();
1039
  return false;
1040
  });
assets/js/b2s/post.js CHANGED
@@ -1,888 +1,958 @@
1
- jQuery.noConflict();
2
-
3
- if (typeof wp.heartbeat !== "undefined") {
4
- jQuery(document).on('heartbeat-send', function (e, data) {
5
- data['b2s_heartbeat'] = 'b2s_listener';
6
- });
7
- wp.heartbeat.connectNow();
8
- }
9
- jQuery(window).on("load", function () {
10
- jQuery('#b2sPagination').val("1");
11
- b2sSortFormSubmit();
12
-
13
- /*if (jQuery('#b2sType').val() != "sched") {
14
- jQuery('.b2s-sched-calendar-btn').hide();
15
- }*/
16
- jQuery('#b2s-sched-calendar-area').hide();
17
-
18
- });
19
-
20
-
21
- function wopApprove(blogPostId, postId, url, name) {
22
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
23
- var win = window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
24
- if (postId > 0) {
25
- function checkIfWinClosed(intervalID) {
26
- if (win.closed) {
27
- clearInterval(intervalID);
28
- //Show Modal
29
- jQuery('.b2s-publish-approve-modal').modal('show');
30
- jQuery('#b2s-approve-post-id').val(postId);
31
- jQuery('#b2s-approve-blog-post-id').val(blogPostId);
32
- }
33
- }
34
- var interval = setInterval(function () {
35
- checkIfWinClosed(interval);
36
- }, 500);
37
- }
38
- }
39
-
40
-
41
- jQuery(document).on('click', '.b2s-sched-calendar-btn', function () {
42
- if (jQuery('#b2s-sched-calendar-area').is(":visible")) {
43
- jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-show-calendar-btn-title'));
44
- jQuery('#b2s-sched-calendar-area').hide();
45
- } else {
46
- jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-hide-calendar-btn-title'));
47
- jQuery('#b2s-sched-calendar-area').show();
48
- }
49
- });
50
-
51
- //Overlay second modal
52
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
53
- jQuery('body').addClass('modal-open');
54
- });
55
- //Overlay second modal
56
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
57
- jQuery('body').addClass('modal-open');
58
- });
59
- jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
60
- jQuery('body').addClass('modal-open');
61
- });
62
-
63
-
64
- jQuery(document).on('click', '.b2sDetailsPublishPostBtn', function () {
65
- var postId = jQuery(this).attr('data-post-id');
66
- var showByDate = jQuery(this).attr('data-search-date');
67
- if (!jQuery(this).find('i').hasClass('isload')) {
68
- jQuery('.b2s-server-connection-fail').hide();
69
- jQuery.ajax({
70
- url: ajaxurl,
71
- type: "POST",
72
- dataType: "json",
73
- cache: false,
74
- data: {
75
- 'action': 'b2s_publish_post_data',
76
- 'postId': postId,
77
- 'type': jQuery('#b2sType').val(),
78
- 'showByDate': showByDate
79
- },
80
- error: function () {
81
- jQuery('.b2s-server-connection-fail').show();
82
- return false;
83
- },
84
- success: function (data) {
85
- if (data.result == true) {
86
- jQuery('.b2s-post-publish-area[data-post-id="' + data.postId + '"]').html(data.content);
87
- }
88
- wp.heartbeat.connectNow();
89
- }
90
- });
91
- jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
92
- } else {
93
- if (jQuery(this).find('i').hasClass('isShow')) {
94
- jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').hide();
95
- jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
96
- } else {
97
- jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').show();
98
- jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
99
- }
100
- }
101
- });
102
-
103
- jQuery(document).on('click', '.b2sDetailsApprovePostBtn', function () {
104
- var postId = jQuery(this).attr('data-post-id');
105
- var showByDate = jQuery(this).attr('data-search-date');
106
- if (!jQuery(this).find('i').hasClass('isload')) {
107
- jQuery('.b2s-server-connection-fail').hide();
108
- jQuery.ajax({
109
- url: ajaxurl,
110
- type: "POST",
111
- dataType: "json",
112
- cache: false,
113
- data: {
114
- 'action': 'b2s_approve_post_data',
115
- 'postId': postId,
116
- 'showByDate': showByDate
117
- },
118
- error: function () {
119
- jQuery('.b2s-server-connection-fail').show();
120
- return false;
121
- },
122
- success: function (data) {
123
- if (data.result == true) {
124
- jQuery('.b2s-post-approve-area[data-post-id="' + data.postId + '"]').html(data.content);
125
- }
126
- }
127
- });
128
- jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
129
- } else {
130
- if (jQuery(this).find('i').hasClass('isShow')) {
131
- jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').hide();
132
- jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
133
- } else {
134
- jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').show();
135
- jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
136
- }
137
- }
138
- });
139
-
140
-
141
- jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
142
- jQuery('#b2sPagination').val("1");
143
- b2sSortFormSubmit();
144
- return false;
145
- });
146
-
147
-
148
- jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
149
- if (event.keyCode == 13) { //Hide Enter
150
- return false;
151
- }
152
- });
153
-
154
- jQuery(document).on('click', '.b2s-pagination-btn', function () {
155
- jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
156
- b2sSortFormSubmit();
157
- return false;
158
- });
159
-
160
- jQuery(document).on('change', '.b2s-select', function () {
161
- jQuery('#b2sPagination').val("1");
162
- b2sSortFormSubmit();
163
- return false;
164
- });
165
-
166
- jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
167
- jQuery('#b2sPagination').val("1");
168
- jQuery('#b2sSortPostTitle').val("");
169
- jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
170
- jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
171
- jQuery('#b2sSortPostType').prop('selectedIndex', 0);
172
- jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
173
- jQuery('#b2sShowByDate').val("");
174
- jQuery('#b2sUserAuthId').val("");
175
- jQuery('#b2sPostBlogId').val("");
176
- jQuery('#b2sShowByNetwork').val("0");
177
- jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
178
- jQuery('#b2sSortPostShareStatus').prop('selectedIndex', 0);
179
- jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
180
- b2sSortFormSubmit();
181
- return false;
182
- });
183
-
184
-
185
- function b2sSortFormSubmit(sched_dates) {
186
- jQuery('.b2s-server-connection-fail').hide();
187
- jQuery('.b2s-loading-area').show();
188
- jQuery('.b2s-sort-result-area').hide();
189
- jQuery('.b2s-sort-result-item-area').html("").hide();
190
- jQuery('.b2s-sort-pagination-area').html("").hide();
191
-
192
- var currentType = jQuery('#b2sType').val();
193
- if (currentType != "undefined") {
194
- jQuery('.b2s-post-btn').removeClass('btn-primary').addClass('btn-link');
195
- jQuery('.b2s-post-' + currentType).removeClass('btn-link').addClass('btn-primary');
196
- }
197
-
198
- var data = {
199
- 'action': 'b2s_sort_data',
200
- 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
201
- 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
202
- 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
203
- 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
204
- 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
205
- 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
206
- 'b2sPostBlogId': jQuery('#b2sPostBlogId').val(),
207
- 'b2sType': jQuery('#b2sType').val(),
208
- 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
209
- 'b2sShowByNetwork': jQuery('#b2sShowByNetwork').val(),
210
- 'b2sPagination': jQuery('#b2sPagination').val(),
211
- 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
212
- 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
213
- 'b2sSortPostShareStatus': jQuery('#b2sSortPostShareStatus').val(),
214
- 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
215
- 'b2sUserLang': jQuery('#b2sUserLang').val()
216
- };
217
-
218
- if (jQuery('#b2sPostsPerPage').length > 0) {
219
- data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
220
- }
221
-
222
- var legacyMode = true;
223
- if (jQuery('#isLegacyMode').val() !== undefined) {
224
- if (jQuery('#isLegacyMode').val() == "1") {
225
- legacyMode = false; // loading is sync (stack)
226
- }
227
- }
228
-
229
-
230
- jQuery.ajax({
231
- url: ajaxurl,
232
- type: "POST",
233
- dataType: "json",
234
- async: legacyMode,
235
- cache: false,
236
- data: data,
237
- error: function () {
238
- jQuery('.b2s-server-connection-fail').show();
239
- return false;
240
- },
241
- success: function (data) {
242
- if (typeof data === 'undefined' || data === null) {
243
- jQuery('.b2s-server-connection-fail').show();
244
- return false;
245
- }
246
- if (data.result == true) {
247
- jQuery('.b2s-loading-area').hide();
248
- jQuery('.b2s-sort-result-area').show();
249
- jQuery('.b2s-sort-result-item-area').html(data.content).show();
250
- jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
251
-
252
- //extern - Routing from dashboard
253
- if (jQuery('#b2sPostBlogId').val() !== undefined) {
254
- if (jQuery('#b2sPostBlogId').val() != "") {
255
- jQuery('.b2sDetailsSchedPostBtn[data-post-id="' + jQuery('#b2sPostBlogId').val() + '"]').trigger('click');
256
- }
257
- }
258
- } else {
259
- jQuery('.b2s-server-connection-fail').show();
260
- return false;
261
- }
262
- }
263
- });
264
- }
265
-
266
- jQuery(document).on('click', '.b2sDetailsSchedPostBtn', function () {
267
- var postId = jQuery(this).attr('data-post-id');
268
- var showByDate = jQuery(this).attr('data-search-date');
269
- var showByNetwork = jQuery(this).attr('data-search-network');
270
- var userAuthId = jQuery('#b2sUserAuthId').val();
271
- if (!jQuery(this).find('i').hasClass('isload')) {
272
- jQuery('.b2s-server-connection-fail').hide();
273
- jQuery.ajax({
274
- url: ajaxurl,
275
- type: "POST",
276
- dataType: "json",
277
- cache: false,
278
- data: {
279
- 'action': 'b2s_sched_post_data',
280
- 'postId': postId,
281
- 'showByDate': showByDate,
282
- 'showByNetwork': showByNetwork,
283
- 'userAuthId': userAuthId
284
- },
285
- error: function () {
286
- jQuery('.b2s-server-connection-fail').show();
287
- return false;
288
- },
289
- success: function (data) {
290
- if (data.result == true) {
291
- jQuery('.b2s-post-sched-area[data-post-id="' + data.postId + '"]').html(data.content);
292
- }
293
- }
294
- });
295
- jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
296
- } else {
297
- if (jQuery(this).find('i').hasClass('isShow')) {
298
- jQuery('.b2s-post-sched-area[data-post-id="' + postId + '"]').hide();
299
- jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
300
- } else {
301
- jQuery('.b2s-post-sched-area[data-post-id="' + postId + '"]').show();
302
- jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
303
- }
304
- }
305
-
306
- });
307
- jQuery(document).on('click', '.b2sDetailsPublishPostTriggerLink', function () {
308
- jQuery(this).parent().prev().find('button').trigger('click');
309
- return false;
310
- });
311
-
312
- jQuery(document).on('click', '.b2sDetailsApprovePostTriggerLink', function () {
313
- jQuery(this).parent().prev().find('button').trigger('click');
314
- return false;
315
- });
316
-
317
- jQuery(document).on('click', '.b2sDetailsSchedPostTriggerLink', function () {
318
- if (jQuery('#b2s-redirect-url-sched-post').val() == undefined || jQuery('#b2s-redirect-url-sched-post').val() === null) {
319
- //self page blog2social-sched
320
- jQuery(this).parent().prev().find('button').trigger('click');
321
- } else {
322
- //extern - routing from dashboard
323
- if (jQuery(this).children('span').attr('data-post-id').length > 0) {
324
- window.location.href = jQuery('#b2s-redirect-url-sched-post').val() + "&b2sPostBlogId=" + jQuery(this).children('span').attr('data-post-id');
325
- }
326
- }
327
- return false;
328
- });
329
- jQuery(document).on('click', '.checkbox-all', function () {
330
- if (jQuery('.checkbox-all').is(":checked")) {
331
- jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]').prop("checked", true);
332
- } else {
333
- jQuery('.checkboxes[data-blog-post-id="' + jQuery('.checkbox-all').attr('data-blog-post-id') + '"]').prop("checked", false);
334
- }
335
- });
336
- jQuery(document).on('click', '.checkbox-post-sched-all-btn', function () {
337
- var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
338
- if (checkboxes.length > 0) {
339
- var items = [];
340
- jQuery(checkboxes).each(function (i, selected) {
341
- items[i] = jQuery(selected).val();
342
- });
343
- jQuery('#b2s-delete-confirm-post-id').val(items.join());
344
- jQuery('#b2s-delete-confirm-post-count').html(items.length);
345
- jQuery('.b2s-delete-sched-modal').modal('show');
346
- jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', false);
347
- }
348
- });
349
- jQuery(document).on('click', '.b2s-post-sched-area-drop-btn', function () {
350
- jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
351
- jQuery('#b2s-delete-confirm-post-count').html('1');
352
- jQuery('.b2s-delete-sched-modal').modal('show');
353
- jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', false);
354
- });
355
- jQuery(document).on('click', '.b2s-sched-delete-confirm-btn', function () {
356
- jQuery('.b2s-post-remove-fail').hide();
357
- jQuery('.b2s-post-remove-success').hide();
358
- jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', true);
359
- jQuery('.b2s-server-connection-fail').hide();
360
- jQuery.ajax({
361
- url: ajaxurl,
362
- type: "POST",
363
- dataType: "json",
364
- cache: false,
365
- data: {
366
- 'action': 'b2s_delete_user_sched_post',
367
- 'postId': jQuery('#b2s-delete-confirm-post-id').val()
368
- },
369
- error: function () {
370
- jQuery('.b2s-server-connection-fail').show();
371
- return false;
372
- },
373
- success: function (data) {
374
- jQuery('.b2s-delete-sched-modal').modal('hide');
375
- if (data.result == true) {
376
- var count = parseInt(jQuery('.b2s-sched-count[data-post-id="' + data.blogPostId + '"]').html());
377
- var newCount = count - data.postCount;
378
- jQuery('.b2s-sched-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
379
- if (newCount >= 1) {
380
- jQuery.each(data.postId, function (i, id) {
381
- jQuery('.b2s-post-sched-area-li[data-post-id="' + id + '"]').remove();
382
- });
383
- } else {
384
- jQuery('.b2s-post-sched-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
385
- }
386
- jQuery('.b2s-post-remove-success').show();
387
- } else {
388
- jQuery('.b2s-post-remove-fail').show();
389
- }
390
- wp.heartbeat.connectNow();
391
- return true;
392
- }
393
- });
394
- });
395
-
396
- jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
397
- var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
398
- if (checkboxes.length > 0) {
399
- var items = [];
400
- jQuery(checkboxes).each(function (i, selected) {
401
- items[i] = jQuery(selected).val();
402
- });
403
- jQuery('#b2s-delete-confirm-post-id').val(items.join());
404
- jQuery('#b2s-delete-confirm-post-count').html(items.length);
405
- jQuery('.b2s-delete-publish-modal').modal('show');
406
- jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
407
- }
408
- });
409
-
410
-
411
- jQuery(document).on('click', '.checkbox-post-approve-all-btn', function () {
412
- var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
413
- if (checkboxes.length > 0) {
414
- var items = [];
415
- jQuery(checkboxes).each(function (i, selected) {
416
- items[i] = jQuery(selected).val();
417
- });
418
- jQuery('#b2s-delete-confirm-post-id').val(items.join());
419
- jQuery('#b2s-delete-confirm-post-count').html(items.length);
420
- jQuery('.b2s-delete-approve-modal').modal('show');
421
- jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
422
- }
423
- });
424
-
425
- jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
426
- jQuery('.b2s-post-remove-fail').hide();
427
- jQuery('.b2s-post-remove-success').hide();
428
- jQuery('.b2s-server-connection-fail').hide();
429
-
430
- var postId = jQuery('#b2s-approve-post-id').val();
431
- var blogPostId = jQuery('#b2s-approve-blog-post-id').val();
432
- if (postId > 0) {
433
- var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + blogPostId + '"]').html());
434
- var newCount = count - 1;
435
- jQuery('.b2s-approve-count[data-post-id="' + blogPostId + '"]').html(newCount);
436
- if (newCount >= 1) {
437
- jQuery('.b2s-post-approve-area-li[data-post-id="' + postId + '"]').remove();
438
- } else {
439
- jQuery('.b2s-post-approve-area-li[data-post-id="' + postId + '"]').closest('ul').closest('li').remove();
440
- }
441
- jQuery('.b2s-publish-approve-modal').modal('hide');
442
- jQuery.ajax({
443
- url: ajaxurl,
444
- type: "POST",
445
- cache: false,
446
- async: false,
447
- data: {
448
- 'action': 'b2s_update_approve_post',
449
- 'post_id': postId,
450
- 'publish_link': "",
451
- 'publish_error_code': "",
452
- },
453
- success: function (data) {
454
- }
455
- });
456
- }
457
- });
458
-
459
-
460
- jQuery(document).on('click', '.b2s-approve-delete-confirm-btn', function () {
461
- jQuery('.b2s-post-remove-fail').hide();
462
- jQuery('.b2s-post-remove-success').hide();
463
- jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', true);
464
- jQuery('.b2s-server-connection-fail').hide();
465
- jQuery.ajax({
466
- url: ajaxurl,
467
- type: "POST",
468
- dataType: "json",
469
- cache: false,
470
- data: {
471
- 'action': 'b2s_delete_user_approve_post',
472
- 'postId': jQuery('#b2s-delete-confirm-post-id').val()
473
- },
474
- error: function () {
475
- jQuery('.b2s-server-connection-fail').show();
476
- return false;
477
- },
478
- success: function (data) {
479
- jQuery('.b2s-delete-approve-modal').modal('hide');
480
- if (data.result == true) {
481
- var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html());
482
- var newCount = count - data.postCount;
483
- jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
484
- if (newCount >= 1) {
485
- jQuery.each(data.postId, function (i, id) {
486
- jQuery('.b2s-post-approve-area-li[data-post-id="' + id + '"]').remove();
487
- });
488
- } else {
489
- jQuery('.b2s-post-approve-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
490
- }
491
- jQuery('.b2s-post-remove-success').show();
492
- } else {
493
- jQuery('.b2s-post-remove-fail').show();
494
- }
495
- wp.heartbeat.connectNow();
496
- return true;
497
- }
498
- });
499
- });
500
-
501
- //Modal Edit Post close
502
- jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
503
- jQuery(jQuery(this).attr('data-modal-name')).remove();
504
- return false;
505
- });
506
-
507
- jQuery(document).on('click', '.b2s-post-approve-area-drop-btn', function () {
508
- jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
509
- jQuery('#b2s-delete-confirm-post-count').html('1');
510
- jQuery('.b2s-delete-approve-modal').modal('show');
511
- jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
512
- });
513
-
514
- jQuery(document).on('click', '.b2s-post-publish-area-drop-btn', function () {
515
- jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
516
- jQuery('#b2s-delete-confirm-post-count').html('1');
517
- jQuery('.b2s-delete-publish-modal').modal('show');
518
- jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
519
- });
520
-
521
- jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
522
- jQuery('.b2s-post-remove-fail').hide();
523
- jQuery('.b2s-post-remove-success').hide();
524
- jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', true);
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_delete_user_publish_post',
533
- 'postId': jQuery('#b2s-delete-confirm-post-id').val()
534
- },
535
- error: function () {
536
- jQuery('.b2s-server-connection-fail').show();
537
- return false;
538
- },
539
- success: function (data) {
540
- jQuery('.b2s-delete-publish-modal').modal('hide');
541
- if (data.result == true) {
542
- var count = parseInt(jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html());
543
- var newCount = count - data.postCount;
544
- jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
545
- if (newCount >= 1) {
546
- jQuery.each(data.postId, function (i, id) {
547
- jQuery('.b2s-post-publish-area-li[data-post-id="' + id + '"]').remove();
548
- });
549
- } else {
550
- jQuery('.b2s-post-publish-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
551
- }
552
- jQuery('.b2s-post-remove-success').show();
553
- } else {
554
- jQuery('.b2s-post-remove-fail').show();
555
- }
556
- wp.heartbeat.connectNow();
557
- return true;
558
- }
559
- });
560
- });
561
-
562
-
563
- jQuery(document).on('click', '.b2s-post-edit-sched-btn', function () {
564
- showEditSchedPost(jQuery(this).attr('data-b2s-id'), jQuery(this).attr('data-post-id'), jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-type'), jQuery(this).attr('data-network-id'), jQuery(this).attr('data-relay-primary-post-id'));
565
-
566
- });
567
-
568
- //Customize
569
- function showEditSchedPost(b2s_id, post_id, network_auth_id, network_type, network_id, relay_primary_post_id) {
570
- if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
571
- {
572
- jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
573
- }
574
- jQuery("#b2sPostId").val(post_id);
575
- var $modal = jQuery("<div>");
576
- jQuery.ajax({
577
- url: ajaxurl,
578
- type: "POST",
579
- cache: false,
580
- async: false,
581
- data: {
582
- 'action': 'b2s_get_post_edit_modal',
583
- 'id': b2s_id
584
- },
585
- success: function (data) {
586
- $modal = $modal.html(data);
587
- }
588
- });
589
- b2s_current_post_id = post_id;
590
- jQuery("body").append($modal);
591
- jQuery(".b2s-edit-post-delete").hide();
592
- jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
593
- jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
594
- var post_format = jQuery('#b2sCurrentPostFormat').val();
595
- activatePortal(network_auth_id);
596
- initSceditor(network_auth_id);
597
- networkCount(network_auth_id);
598
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
599
- var postFormatText = b2s_post_formats;
600
- var isSetPostFormat = false;
601
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
602
- //is set post format => override current condidtions by user settings for this post
603
- if (post_format !== null) {
604
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
605
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
606
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
607
- //edit modal select post format
608
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
609
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"][data-post-format="' + post_format + '"]').addClass('b2s-settings-checked');
610
- } else {
611
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val()]);
612
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val());
613
- }
614
-
615
- //if linkpost then show btn meta tags
616
- var isMetaChecked = false;
617
- if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
618
- isMetaChecked = true;
619
- }
620
- if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
621
- isMetaChecked = true;
622
- }
623
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
624
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
625
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
626
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
627
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
628
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
629
- if (dataMetaType == "og") {
630
- jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
631
- } else {
632
- jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
633
- }
634
-
635
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
636
- if (network_id == 1 && network_type == 0) {
637
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
638
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
639
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
640
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
641
- }
642
-
643
- } else {
644
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
645
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
646
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
647
-
648
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
649
- if (network_id == 1 && network_type == 0) {
650
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
651
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
652
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
653
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
654
- }
655
- }
656
-
657
- //Content Curation
658
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
659
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
660
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
661
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
662
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
663
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
664
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
665
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
666
- } else {
667
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
668
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
669
- }
670
- }
671
-
672
- }
673
- var today = new Date();
674
- var dateFormat = "yyyy-mm-dd";
675
- var language = "en";
676
- var showMeridian = true;
677
- if (jQuery('#b2sUserLang').val() == "de") {
678
- dateFormat = "dd.mm.yyyy";
679
- language = "de";
680
- showMeridian = false;
681
- }
682
-
683
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
684
- format: dateFormat,
685
- language: language,
686
- maxViewMode: 2,
687
- todayHighlight: true,
688
- startDate: today,
689
- calendarWeeks: true,
690
- autoclose: true
691
- });
692
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
693
- minuteStep: 15,
694
- appendWidgetTo: 'body',
695
- showSeconds: false,
696
- showMeridian: showMeridian,
697
- defaultTime: 'current',
698
- snapToStep: true
699
- });
700
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
701
- checkSchedDateTime(network_auth_id);
702
- });
703
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
704
- checkSchedDateTime(network_auth_id);
705
- });
706
- init();
707
-
708
- //is relay post?
709
- if (relay_primary_post_id > 0) {
710
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
711
- if (!jQuery(this).hasClass('b2s-input-hidden') && !jQuery(this).hasClass('b2s-modal-close') && !jQuery(this).hasClass('b2s-post-item-details-relay-input-delay') && !jQuery(this).hasClass('b2s-edit-post-delete') && !jQuery(this).hasClass('b2s-edit-post-save-this')) {
712
- jQuery(this).prop("disabled", true);
713
- }
714
- });
715
- }
716
-
717
- if (!b2s_has_premium)
718
- {
719
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
720
- if (!jQuery(this).hasClass('b2s-modal-close')) {
721
- jQuery(this).prop("disabled", true);
722
- }
723
- });
724
- }
725
- }
726
-
727
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
728
- jQuery('.b2s-network-select-image-content').html("");
729
- jQuery.ajax({
730
- url: ajaxurl,
731
- type: "POST",
732
- cache: false,
733
- async: false,
734
- data: {
735
- 'action': 'b2s_get_image_modal',
736
- 'id': jQuery(this).data('post-id'),
737
- 'image_url': jQuery(this).data('image-url')
738
- },
739
- success: function (data) {
740
- jQuery(".b2s-network-select-image-content").html(data);
741
- }
742
- });
743
- var authId = jQuery(this).data('network-auth-id');
744
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
745
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
746
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
747
- jQuery('.b2s-selected-network-for-image-info').html(content);
748
- jQuery('#b2sInsertImageType').val("0");
749
- jQuery('.networkImage').each(function () {
750
- var width = this.naturalWidth;
751
- var height = this.naturalHeight;
752
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
753
- });
754
- jQuery('#b2s-network-select-image').modal('show');
755
- return false;
756
- });
757
-
758
- jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
759
- e.preventDefault();
760
- jQuery('#save_method').val("apply-this");
761
- var id = jQuery(this).data("b2s-id");
762
- jQuery.ajax({
763
- url: ajaxurl,
764
- type: "POST",
765
- dataType: "json",
766
- cache: false,
767
- data: jQuery(this).closest("form").serialize(),
768
- success: function (data) {
769
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
770
- jQuery('#b2s-edit-event-modal-' + id).remove();
771
- jQuery('body').removeClass('modal-open');
772
- jQuery('body').removeAttr('style');
773
- if (data.date != "") {
774
- jQuery('.b2s-post-sched-area-sched-time[data-post-id="' + id + '"]').html(data.date);
775
- }
776
- jQuery('.b2s-post-edit-success').show();
777
- wp.heartbeat.connectNow();
778
- }
779
- });
780
- });
781
- jQuery(document).on("click", ".release_locks", function () {
782
- jQuery.ajax({
783
- url: ajaxurl,
784
- type: "POST",
785
- cache: false,
786
- async: false,
787
- data: {
788
- 'action': 'b2s_get_calendar_release_locks',
789
- 'post_id': jQuery('#post_id').val()
790
- },
791
- success: function (data) {
792
- wp.heartbeat.connectNow();
793
- }
794
- });
795
- });
796
-
797
-
798
-
799
- function showFilter(typ) {
800
- if (typ == 'show') {
801
- jQuery('.filterShow').hide();
802
- jQuery('.form-inline').show();
803
- jQuery('.filterHide').show();
804
- } else {
805
- jQuery('.filterShow').show();
806
- jQuery('.form-inline').hide();
807
- jQuery('.filterHide').hide();
808
- }
809
- }
810
-
811
- function padDate(n) {
812
- return ("0" + n).slice(-2);
813
- }
814
-
815
-
816
- function checkSchedDateTime() {
817
- var dateElement = '#b2s-change-date';
818
- var timeElement = '#b2s-change-time';
819
- var dateStr = jQuery(dateElement).val();
820
- var minStr = jQuery(timeElement).val();
821
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
822
-
823
- if (jQuery('#b2sUserLang').val() == 'de') {
824
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
825
- } else {
826
- var minParts = minStr.split(' ');
827
- var minParts2 = minParts[0].split(':');
828
- if (minParts[1] == 'PM') {
829
- minParts2[0] = parseInt(minParts2[0]) + 12;
830
- }
831
- minStr = minParts2[0] + ':' + minParts2[1];
832
- }
833
-
834
- var minParts3 = minStr.split(':');
835
- if (minParts3[0] < 10) {
836
- minParts3[0] = '0' + minParts3[0];
837
- }
838
- var dateParts = dateStr.split('-');
839
-
840
- //utc current time
841
- var now = new Date();
842
- //offset between utc und user
843
- var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
844
- //enter hour to user time
845
- var hour = parseInt(minParts3[0]) + timeZone + offset;
846
- //calculate datetime in utc
847
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
848
- //compare enter date time with allowed user time
849
- if (enter.getTime() < now.getTime()) {
850
- //enter set on next 15 minutes and calculate on user timezone
851
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
852
- jQuery(dateElement).datepicker('update', enter);
853
- jQuery(timeElement).timepicker('setTime', enter);
854
- }
855
- }
856
-
857
-
858
- window.addEventListener('message', function (e) {
859
- if (e.origin == jQuery('#b2sServerUrl').val()) {
860
- var data = JSON.parse(e.data);
861
- if (data.action == 'approve') {
862
- var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blog_post_id + '"]').html());
863
- var newCount = count - 1;
864
- jQuery('.b2s-approve-count[data-post-id="' + data.blog_post_id + '"]').html(newCount);
865
- if (newCount >= 1) {
866
- jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').remove();
867
- } else {
868
- jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').closest('ul').closest('li').remove();
869
- }
870
- jQuery.ajax({
871
- url: ajaxurl,
872
- type: "POST",
873
- cache: false,
874
- async: false,
875
- data: {
876
- 'action': 'b2s_update_approve_post',
877
- 'post_id': data.post_id,
878
- 'publish_link': data.publish_link,
879
- 'publish_error_code': data.publish_error_code,
880
- },
881
- success: function (data) {
882
-
883
- }
884
- });
885
- }
886
- }
887
- });
888
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+ if (typeof wp.heartbeat !== "undefined") {
4
+ jQuery(document).on('heartbeat-send', function (e, data) {
5
+ data['b2s_heartbeat'] = 'b2s_listener';
6
+ });
7
+ wp.heartbeat.connectNow();
8
+ }
9
+ jQuery(window).on("load", function () {
10
+ jQuery('#b2sPagination').val("1");
11
+ b2sSortFormSubmit();
12
+
13
+ /*if (jQuery('#b2sType').val() != "sched") {
14
+ jQuery('.b2s-sched-calendar-btn').hide();
15
+ }*/
16
+ jQuery('#b2s-sched-calendar-area').hide();
17
+
18
+ });
19
+
20
+
21
+ function wopApprove(blogPostId, postId, url, name) {
22
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
23
+ var win = window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
24
+ if (postId > 0) {
25
+ function checkIfWinClosed(intervalID) {
26
+ if (win.closed) {
27
+ clearInterval(intervalID);
28
+ //Show Modal
29
+ jQuery('.b2s-publish-approve-modal').modal('show');
30
+ jQuery('#b2s-approve-post-id').val(postId);
31
+ jQuery('#b2s-approve-blog-post-id').val(blogPostId);
32
+ }
33
+ }
34
+ var interval = setInterval(function () {
35
+ checkIfWinClosed(interval);
36
+ }, 500);
37
+ }
38
+ }
39
+
40
+
41
+ jQuery(document).on('click', '.b2s-sched-calendar-btn', function () {
42
+ if (jQuery('#b2s-sched-calendar-area').is(":visible")) {
43
+ jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-show-calendar-btn-title'));
44
+ jQuery('#b2s-sched-calendar-area').hide();
45
+ } else {
46
+ jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-hide-calendar-btn-title'));
47
+ jQuery('#b2s-sched-calendar-area').show();
48
+ }
49
+ });
50
+
51
+ //Overlay second modal
52
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
53
+ jQuery('body').addClass('modal-open');
54
+ });
55
+ //Overlay second modal
56
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
57
+ jQuery('body').addClass('modal-open');
58
+ });
59
+ jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
60
+ jQuery('body').addClass('modal-open');
61
+ });
62
+
63
+
64
+ jQuery(document).on('click', '.b2sDetailsPublishPostBtn', function () {
65
+ var postId = jQuery(this).attr('data-post-id');
66
+ var showByDate = jQuery(this).attr('data-search-date');
67
+ if (!jQuery(this).find('i').hasClass('isload')) {
68
+ jQuery('.b2s-server-connection-fail').hide();
69
+ jQuery.ajax({
70
+ url: ajaxurl,
71
+ type: "POST",
72
+ dataType: "json",
73
+ cache: false,
74
+ data: {
75
+ 'action': 'b2s_publish_post_data',
76
+ 'postId': postId,
77
+ 'type': jQuery('#b2sType').val(),
78
+ 'showByDate': showByDate
79
+ },
80
+ error: function () {
81
+ jQuery('.b2s-server-connection-fail').show();
82
+ return false;
83
+ },
84
+ success: function (data) {
85
+ if (data.result == true) {
86
+ jQuery('.b2s-post-publish-area[data-post-id="' + data.postId + '"]').html(data.content);
87
+ }
88
+ wp.heartbeat.connectNow();
89
+ }
90
+ });
91
+ jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
92
+ } else {
93
+ if (jQuery(this).find('i').hasClass('isShow')) {
94
+ jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').hide();
95
+ jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
96
+ } else {
97
+ jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').show();
98
+ jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
99
+ }
100
+ }
101
+ });
102
+
103
+ jQuery(document).on('click', '.b2sDetailsApprovePostBtn', function () {
104
+ var postId = jQuery(this).attr('data-post-id');
105
+ var showByDate = jQuery(this).attr('data-search-date');
106
+ if (!jQuery(this).find('i').hasClass('isload')) {
107
+ jQuery('.b2s-server-connection-fail').hide();
108
+ jQuery.ajax({
109
+ url: ajaxurl,
110
+ type: "POST",
111
+ dataType: "json",
112
+ cache: false,
113
+ data: {
114
+ 'action': 'b2s_approve_post_data',
115
+ 'postId': postId,
116
+ 'showByDate': showByDate
117
+ },
118
+ error: function () {
119
+ jQuery('.b2s-server-connection-fail').show();
120
+ return false;
121
+ },
122
+ success: function (data) {
123
+ if (data.result == true) {
124
+ jQuery('.b2s-post-approve-area[data-post-id="' + data.postId + '"]').html(data.content);
125
+ }
126
+ }
127
+ });
128
+ jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
129
+ } else {
130
+ if (jQuery(this).find('i').hasClass('isShow')) {
131
+ jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').hide();
132
+ jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
133
+ } else {
134
+ jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').show();
135
+ jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
136
+ }
137
+ }
138
+ });
139
+
140
+
141
+ jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
142
+ jQuery('#b2sPagination').val("1");
143
+ b2sSortFormSubmit();
144
+ return false;
145
+ });
146
+
147
+
148
+ jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
149
+ if (event.keyCode == 13) { //Hide Enter
150
+ return false;
151
+ }
152
+ });
153
+
154
+ jQuery(document).on('click', '.b2s-pagination-btn', function () {
155
+ jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
156
+ b2sSortFormSubmit();
157
+ return false;
158
+ });
159
+
160
+ jQuery(document).on('change', '.b2s-select', function () {
161
+ jQuery('#b2sPagination').val("1");
162
+ b2sSortFormSubmit();
163
+ return false;
164
+ });
165
+
166
+ jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
167
+ jQuery('#b2sPagination').val("1");
168
+ jQuery('#b2sSortPostTitle').val("");
169
+ jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
170
+ jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
171
+ jQuery('#b2sSortPostType').prop('selectedIndex', 0);
172
+ jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
173
+ jQuery('#b2sShowByDate').val("");
174
+ jQuery('#b2sUserAuthId').val("");
175
+ jQuery('#b2sPostBlogId').val("");
176
+ jQuery('#b2sShowByNetwork').val("0");
177
+ jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
178
+ jQuery('#b2sSortPostShareStatus').prop('selectedIndex', 0);
179
+ jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
180
+ b2sSortFormSubmit();
181
+ return false;
182
+ });
183
+
184
+
185
+ function b2sSortFormSubmit(sched_dates) {
186
+ jQuery('.b2s-server-connection-fail').hide();
187
+ jQuery('.b2s-loading-area').show();
188
+ jQuery('.b2s-sort-result-area').hide();
189
+ jQuery('.b2s-sort-result-item-area').html("").hide();
190
+ jQuery('.b2s-sort-pagination-area').html("").hide();
191
+
192
+ var currentType = jQuery('#b2sType').val();
193
+ if (currentType != "undefined") {
194
+ jQuery('.b2s-post-btn').removeClass('btn-primary').addClass('btn-link');
195
+ jQuery('.b2s-post-' + currentType).removeClass('btn-link').addClass('btn-primary');
196
+ }
197
+
198
+ var data = {
199
+ 'action': 'b2s_sort_data',
200
+ 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
201
+ 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
202
+ 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
203
+ 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
204
+ 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
205
+ 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
206
+ 'b2sPostBlogId': jQuery('#b2sPostBlogId').val(),
207
+ 'b2sType': jQuery('#b2sType').val(),
208
+ 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
209
+ 'b2sShowByNetwork': jQuery('#b2sShowByNetwork').val(),
210
+ 'b2sPagination': jQuery('#b2sPagination').val(),
211
+ 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
212
+ 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
213
+ 'b2sSortPostShareStatus': jQuery('#b2sSortPostShareStatus').val(),
214
+ 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
215
+ 'b2sUserLang': jQuery('#b2sUserLang').val()
216
+ };
217
+
218
+ if (jQuery('#b2sPostsPerPage').length > 0) {
219
+ data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
220
+ }
221
+
222
+ var legacyMode = true;
223
+ if (jQuery('#isLegacyMode').val() !== undefined) {
224
+ if (jQuery('#isLegacyMode').val() == "1") {
225
+ legacyMode = false; // loading is sync (stack)
226
+ }
227
+ }
228
+
229
+
230
+ jQuery.ajax({
231
+ url: ajaxurl,
232
+ type: "POST",
233
+ dataType: "json",
234
+ async: legacyMode,
235
+ cache: false,
236
+ data: data,
237
+ error: function () {
238
+ jQuery('.b2s-server-connection-fail').show();
239
+ return false;
240
+ },
241
+ success: function (data) {
242
+ if (typeof data === 'undefined' || data === null) {
243
+ jQuery('.b2s-server-connection-fail').show();
244
+ return false;
245
+ }
246
+ if (data.result == true) {
247
+ jQuery('.b2s-loading-area').hide();
248
+ jQuery('.b2s-sort-result-area').show();
249
+ jQuery('.b2s-sort-result-item-area').html(data.content).show();
250
+ jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
251
+
252
+ //extern - Routing from dashboard
253
+ if (jQuery('#b2sPostBlogId').val() !== undefined) {
254
+ if (jQuery('#b2sPostBlogId').val() != "") {
255
+ jQuery('.b2sDetailsSchedPostBtn[data-post-id="' + jQuery('#b2sPostBlogId').val() + '"]').trigger('click');
256
+ }
257
+ }
258
+ } else {
259
+ jQuery('.b2s-server-connection-fail').show();
260
+ return false;
261
+ }
262
+ }
263
+ });
264
+ }
265
+
266
+ jQuery(document).on('click', '.b2sDetailsSchedPostBtn', function () {
267
+ var postId = jQuery(this).attr('data-post-id');
268
+ var showByDate = jQuery(this).attr('data-search-date');
269
+ var showByNetwork = jQuery(this).attr('data-search-network');
270
+ var userAuthId = jQuery('#b2sUserAuthId').val();
271
+ if (!jQuery(this).find('i').hasClass('isload')) {
272
+ jQuery('.b2s-server-connection-fail').hide();
273
+ jQuery.ajax({
274
+ url: ajaxurl,
275
+ type: "POST",
276
+ dataType: "json",
277
+ cache: false,
278
+ data: {
279
+ 'action': 'b2s_sched_post_data',
280
+ 'postId': postId,
281
+ 'showByDate': showByDate,
282
+ 'showByNetwork': showByNetwork,
283
+ 'userAuthId': userAuthId
284
+ },
285
+ error: function () {
286
+ jQuery('.b2s-server-connection-fail').show();
287
+ return false;
288
+ },
289
+ success: function (data) {
290
+ if (data.result == true) {
291
+ jQuery('.b2s-post-sched-area[data-post-id="' + data.postId + '"]').html(data.content);
292
+ }
293
+ }
294
+ });
295
+ jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
296
+ } else {
297
+ if (jQuery(this).find('i').hasClass('isShow')) {
298
+ jQuery('.b2s-post-sched-area[data-post-id="' + postId + '"]').hide();
299
+ jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
300
+ } else {
301
+ jQuery('.b2s-post-sched-area[data-post-id="' + postId + '"]').show();
302
+ jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
303
+ }
304
+ }
305
+
306
+ });
307
+ jQuery(document).on('click', '.b2sDetailsPublishPostTriggerLink', function () {
308
+ jQuery(this).parent().prev().find('button').trigger('click');
309
+ return false;
310
+ });
311
+
312
+ jQuery(document).on('click', '.b2sDetailsApprovePostTriggerLink', function () {
313
+ jQuery(this).parent().prev().find('button').trigger('click');
314
+ return false;
315
+ });
316
+
317
+ jQuery(document).on('click', '.b2sDetailsSchedPostTriggerLink', function () {
318
+ if (jQuery('#b2s-redirect-url-sched-post').val() == undefined || jQuery('#b2s-redirect-url-sched-post').val() === null) {
319
+ //self page blog2social-sched
320
+ jQuery(this).parent().prev().find('button').trigger('click');
321
+ } else {
322
+ //extern - routing from dashboard
323
+ if (jQuery(this).children('span').attr('data-post-id').length > 0) {
324
+ window.location.href = jQuery('#b2s-redirect-url-sched-post').val() + "&b2sPostBlogId=" + jQuery(this).children('span').attr('data-post-id');
325
+ }
326
+ }
327
+ return false;
328
+ });
329
+ jQuery(document).on('click', '.checkbox-all', function () {
330
+ if (jQuery('.checkbox-all').is(":checked")) {
331
+ jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]').prop("checked", true);
332
+ } else {
333
+ jQuery('.checkboxes[data-blog-post-id="' + jQuery('.checkbox-all').attr('data-blog-post-id') + '"]').prop("checked", false);
334
+ }
335
+ });
336
+ jQuery(document).on('click', '.checkbox-post-sched-all-btn', function () {
337
+ var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
338
+ if (checkboxes.length > 0) {
339
+ var items = [];
340
+ jQuery(checkboxes).each(function (i, selected) {
341
+ items[i] = jQuery(selected).val();
342
+ });
343
+ jQuery('#b2s-delete-confirm-post-id').val(items.join());
344
+ jQuery('#b2s-delete-confirm-post-count').html(items.length);
345
+ jQuery('.b2s-delete-sched-modal').modal('show');
346
+ jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', false);
347
+ }
348
+ });
349
+ jQuery(document).on('click', '.b2s-post-sched-area-drop-btn', function () {
350
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
351
+ jQuery('#b2s-delete-confirm-post-count').html('1');
352
+ jQuery('.b2s-delete-sched-modal').modal('show');
353
+ jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', false);
354
+ });
355
+ jQuery(document).on('click', '.b2s-sched-delete-confirm-btn', function () {
356
+ jQuery('.b2s-post-remove-fail').hide();
357
+ jQuery('.b2s-post-remove-success').hide();
358
+ jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', true);
359
+ jQuery('.b2s-server-connection-fail').hide();
360
+ jQuery.ajax({
361
+ url: ajaxurl,
362
+ type: "POST",
363
+ dataType: "json",
364
+ cache: false,
365
+ data: {
366
+ 'action': 'b2s_delete_user_sched_post',
367
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val()
368
+ },
369
+ error: function () {
370
+ jQuery('.b2s-server-connection-fail').show();
371
+ return false;
372
+ },
373
+ success: function (data) {
374
+ jQuery('.b2s-delete-sched-modal').modal('hide');
375
+ if (data.result == true) {
376
+ var count = parseInt(jQuery('.b2s-sched-count[data-post-id="' + data.blogPostId + '"]').html());
377
+ var newCount = count - data.postCount;
378
+ jQuery('.b2s-sched-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
379
+ if (newCount >= 1) {
380
+ jQuery.each(data.postId, function (i, id) {
381
+ jQuery('.b2s-post-sched-area-li[data-post-id="' + id + '"]').remove();
382
+ });
383
+ } else {
384
+ jQuery('.b2s-post-sched-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
385
+ }
386
+ jQuery('.b2s-post-remove-success').show();
387
+ } else {
388
+ jQuery('.b2s-post-remove-fail').show();
389
+ }
390
+ wp.heartbeat.connectNow();
391
+ return true;
392
+ }
393
+ });
394
+ });
395
+
396
+ jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
397
+ var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
398
+ if (checkboxes.length > 0) {
399
+ var items = [];
400
+ jQuery(checkboxes).each(function (i, selected) {
401
+ items[i] = jQuery(selected).val();
402
+ });
403
+ jQuery('#b2s-delete-confirm-post-id').val(items.join());
404
+ jQuery('#b2s-delete-confirm-post-count').html(items.length);
405
+ jQuery('.b2s-delete-publish-modal').modal('show');
406
+ jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
407
+ }
408
+ });
409
+
410
+
411
+ jQuery(document).on('click', '.checkbox-post-approve-all-btn', function () {
412
+ var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
413
+ if (checkboxes.length > 0) {
414
+ var items = [];
415
+ jQuery(checkboxes).each(function (i, selected) {
416
+ items[i] = jQuery(selected).val();
417
+ });
418
+ jQuery('#b2s-delete-confirm-post-id').val(items.join());
419
+ jQuery('#b2s-delete-confirm-post-count').html(items.length);
420
+ jQuery('.b2s-delete-approve-modal').modal('show');
421
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
422
+ }
423
+ });
424
+
425
+ jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
426
+ jQuery('.b2s-post-remove-fail').hide();
427
+ jQuery('.b2s-post-remove-success').hide();
428
+ jQuery('.b2s-server-connection-fail').hide();
429
+
430
+ var postId = jQuery('#b2s-approve-post-id').val();
431
+ var blogPostId = jQuery('#b2s-approve-blog-post-id').val();
432
+ if (postId > 0) {
433
+ var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + blogPostId + '"]').html());
434
+ var newCount = count - 1;
435
+ jQuery('.b2s-approve-count[data-post-id="' + blogPostId + '"]').html(newCount);
436
+ if (newCount >= 1) {
437
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + postId + '"]').remove();
438
+ } else {
439
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + postId + '"]').closest('ul').closest('li').remove();
440
+ }
441
+ jQuery('.b2s-publish-approve-modal').modal('hide');
442
+ jQuery.ajax({
443
+ url: ajaxurl,
444
+ type: "POST",
445
+ cache: false,
446
+ async: false,
447
+ data: {
448
+ 'action': 'b2s_update_approve_post',
449
+ 'post_id': postId,
450
+ 'publish_link': "",
451
+ 'publish_error_code': "",
452
+ },
453
+ success: function (data) {
454
+ }
455
+ });
456
+ }
457
+ });
458
+
459
+
460
+ jQuery(document).on('click', '.b2s-approve-delete-confirm-btn', function () {
461
+ jQuery('.b2s-post-remove-fail').hide();
462
+ jQuery('.b2s-post-remove-success').hide();
463
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', true);
464
+ jQuery('.b2s-server-connection-fail').hide();
465
+ jQuery.ajax({
466
+ url: ajaxurl,
467
+ type: "POST",
468
+ dataType: "json",
469
+ cache: false,
470
+ data: {
471
+ 'action': 'b2s_delete_user_approve_post',
472
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val()
473
+ },
474
+ error: function () {
475
+ jQuery('.b2s-server-connection-fail').show();
476
+ return false;
477
+ },
478
+ success: function (data) {
479
+ jQuery('.b2s-delete-approve-modal').modal('hide');
480
+ if (data.result == true) {
481
+ var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html());
482
+ var newCount = count - data.postCount;
483
+ jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
484
+ if (newCount >= 1) {
485
+ jQuery.each(data.postId, function (i, id) {
486
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + id + '"]').remove();
487
+ });
488
+ } else {
489
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
490
+ }
491
+ jQuery('.b2s-post-remove-success').show();
492
+ } else {
493
+ jQuery('.b2s-post-remove-fail').show();
494
+ }
495
+ wp.heartbeat.connectNow();
496
+ return true;
497
+ }
498
+ });
499
+ });
500
+
501
+ //Modal Edit Post close
502
+ jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
503
+ jQuery(jQuery(this).attr('data-modal-name')).remove();
504
+ return false;
505
+ });
506
+
507
+ jQuery(document).on('click', '.b2s-post-approve-area-drop-btn', function () {
508
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
509
+ jQuery('#b2s-delete-confirm-post-count').html('1');
510
+ jQuery('.b2s-delete-approve-modal').modal('show');
511
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
512
+ });
513
+
514
+ jQuery(document).on('click', '.b2s-post-publish-area-drop-btn', function () {
515
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
516
+ jQuery('#b2s-delete-confirm-post-count').html('1');
517
+ jQuery('.b2s-delete-publish-modal').modal('show');
518
+ jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
519
+ });
520
+
521
+ jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
522
+ jQuery('.b2s-post-remove-fail').hide();
523
+ jQuery('.b2s-post-remove-success').hide();
524
+ jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', true);
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_delete_user_publish_post',
533
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val()
534
+ },
535
+ error: function () {
536
+ jQuery('.b2s-server-connection-fail').show();
537
+ return false;
538
+ },
539
+ success: function (data) {
540
+ jQuery('.b2s-delete-publish-modal').modal('hide');
541
+ if (data.result == true) {
542
+ var count = parseInt(jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html());
543
+ var newCount = count - data.postCount;
544
+ jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
545
+ if (newCount >= 1) {
546
+ jQuery.each(data.postId, function (i, id) {
547
+ jQuery('.b2s-post-publish-area-li[data-post-id="' + id + '"]').remove();
548
+ });
549
+ } else {
550
+ jQuery('.b2s-post-publish-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
551
+ }
552
+ jQuery('.b2s-post-remove-success').show();
553
+ } else {
554
+ jQuery('.b2s-post-remove-fail').show();
555
+ }
556
+ wp.heartbeat.connectNow();
557
+ return true;
558
+ }
559
+ });
560
+ });
561
+
562
+
563
+ jQuery(document).on('click', '.b2s-post-edit-sched-btn', function () {
564
+ showEditSchedPost(jQuery(this).attr('data-b2s-id'), jQuery(this).attr('data-post-id'), jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-type'), jQuery(this).attr('data-network-id'), jQuery(this).attr('data-relay-primary-post-id'));
565
+
566
+ });
567
+
568
+ //Customize
569
+ function showEditSchedPost(b2s_id, post_id, network_auth_id, network_type, network_id, relay_primary_post_id) {
570
+ if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
571
+ {
572
+ jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
573
+ }
574
+ jQuery("#b2sPostId").val(post_id);
575
+ var $modal = jQuery("<div>");
576
+ jQuery.ajax({
577
+ url: ajaxurl,
578
+ type: "POST",
579
+ cache: false,
580
+ async: false,
581
+ data: {
582
+ 'action': 'b2s_get_post_edit_modal',
583
+ 'id': b2s_id
584
+ },
585
+ success: function (data) {
586
+ $modal = $modal.html(data);
587
+ }
588
+ });
589
+ b2s_current_post_id = post_id;
590
+ jQuery("body").append($modal);
591
+ jQuery(".b2s-edit-post-delete").hide();
592
+ jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
593
+ jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
594
+ var post_format = jQuery('#b2sCurrentPostFormat').val();
595
+ activatePortal(network_auth_id);
596
+ initSceditor(network_auth_id);
597
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
598
+ var postFormatText = b2s_post_formats;
599
+ var isSetPostFormat = false;
600
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
601
+ //is set post format => override current condidtions by user settings for this post
602
+ if (post_format !== null) {
603
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
604
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
605
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
606
+ //edit modal select post format
607
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
608
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"][data-post-format="' + post_format + '"]').addClass('b2s-settings-checked');
609
+ } else {
610
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val()]);
611
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val());
612
+ }
613
+
614
+ //if linkpost then show btn meta tags
615
+ var isMetaChecked = false;
616
+ if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
617
+ isMetaChecked = true;
618
+ }
619
+ if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
620
+ isMetaChecked = true;
621
+ }
622
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
623
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
624
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
625
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
626
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
627
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
628
+ if (dataMetaType == "og") {
629
+ jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
630
+ } else {
631
+ jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
632
+ }
633
+
634
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
635
+ if (network_id == 1 && network_type == 0) {
636
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
637
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
638
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
639
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
640
+ }
641
+
642
+ } else {
643
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
644
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
645
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
646
+
647
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
648
+ if (network_id == 1 && network_type == 0) {
649
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
650
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
651
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
652
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
653
+ }
654
+ }
655
+
656
+ //Content Curation
657
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
658
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
659
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
660
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
661
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
662
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
663
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
664
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
665
+ } else {
666
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
667
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
668
+ }
669
+ }
670
+
671
+ if (network_id == "3") {
672
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
673
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').show();
674
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').trigger("click");
675
+ jQuery('.linkedin-url-title[data-network-auth-id="' + network_auth_id + '"]').show();
676
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide(); //not showing on linkedin
677
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
678
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
679
+ } else {
680
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').hide();
681
+ jQuery('.linkedin-url-title[data-network-auth-id="' + network_auth_id + '"]').hide();
682
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide();
683
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
684
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
685
+ }
686
+ }
687
+
688
+ if (network_id == "19" && network_type == "0") {
689
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
690
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').show();
691
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').trigger("click");
692
+ jQuery('.xing-url-title[data-network-auth-id="' + network_auth_id + '"]').show();
693
+ jQuery('.xing-url-desc[data-network-auth-id="' + network_auth_id + '"]').show();
694
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
695
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
696
+ } else {
697
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').hide();
698
+ jQuery('.xing-url-title[data-network-auth-id="' + network_auth_id + '"]').hide();
699
+ jQuery('.xing-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide();
700
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
701
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
702
+ }
703
+ }
704
+
705
+ }
706
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + network_auth_id + '"]').attr('data-network-text-limit');
707
+ if (textLimit != "0") {
708
+ networkLimitAll(network_auth_id, network_id, textLimit);
709
+ } else {
710
+ networkCount(network_auth_id);
711
+ }
712
+ var today = new Date();
713
+ var dateFormat = "yyyy-mm-dd";
714
+ var language = "en";
715
+ var showMeridian = true;
716
+ if (jQuery('#b2sUserLang').val() == "de") {
717
+ dateFormat = "dd.mm.yyyy";
718
+ language = "de";
719
+ showMeridian = false;
720
+ }
721
+
722
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
723
+ format: dateFormat,
724
+ language: language,
725
+ maxViewMode: 2,
726
+ todayHighlight: true,
727
+ startDate: today,
728
+ calendarWeeks: true,
729
+ autoclose: true
730
+ });
731
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
732
+ minuteStep: 15,
733
+ appendWidgetTo: 'body',
734
+ showSeconds: false,
735
+ showMeridian: showMeridian,
736
+ defaultTime: 'current',
737
+ snapToStep: true
738
+ });
739
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
740
+ checkSchedDateTime(network_auth_id);
741
+ });
742
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
743
+ checkSchedDateTime(network_auth_id);
744
+ });
745
+ init();
746
+
747
+ //is relay post?
748
+ if (relay_primary_post_id > 0) {
749
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
750
+ if (!jQuery(this).hasClass('b2s-input-hidden') && !jQuery(this).hasClass('b2s-modal-close') && !jQuery(this).hasClass('b2s-post-item-details-relay-input-delay') && !jQuery(this).hasClass('b2s-edit-post-delete') && !jQuery(this).hasClass('b2s-edit-post-save-this')) {
751
+ jQuery(this).prop("disabled", true);
752
+ }
753
+ });
754
+ }
755
+
756
+ if (!b2s_has_premium)
757
+ {
758
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
759
+ if (!jQuery(this).hasClass('b2s-modal-close')) {
760
+ jQuery(this).prop("disabled", true);
761
+ }
762
+ });
763
+ }
764
+ }
765
+
766
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
767
+ jQuery('.b2s-network-select-image-content').html("");
768
+ jQuery.ajax({
769
+ url: ajaxurl,
770
+ type: "POST",
771
+ cache: false,
772
+ async: false,
773
+ data: {
774
+ 'action': 'b2s_get_image_modal',
775
+ 'id': jQuery(this).data('post-id'),
776
+ 'image_url': jQuery(this).data('image-url')
777
+ },
778
+ success: function (data) {
779
+ jQuery(".b2s-network-select-image-content").html(data);
780
+ }
781
+ });
782
+ var authId = jQuery(this).data('network-auth-id');
783
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
784
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
785
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
786
+ jQuery('.b2s-selected-network-for-image-info').html(content);
787
+ jQuery('#b2sInsertImageType').val("0");
788
+ jQuery('.networkImage').each(function () {
789
+ var width = this.naturalWidth;
790
+ var height = this.naturalHeight;
791
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
792
+ });
793
+ jQuery('#b2s-network-select-image').modal('show');
794
+ return false;
795
+ });
796
+
797
+ jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
798
+ e.preventDefault();
799
+ jQuery('#save_method').val("apply-this");
800
+ var id = jQuery(this).data("b2s-id");
801
+ jQuery.ajax({
802
+ url: ajaxurl,
803
+ type: "POST",
804
+ dataType: "json",
805
+ cache: false,
806
+ data: jQuery(this).closest("form").serialize(),
807
+ success: function (data) {
808
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
809
+ jQuery('#b2s-edit-event-modal-' + id).remove();
810
+ jQuery('body').removeClass('modal-open');
811
+ jQuery('body').removeAttr('style');
812
+ if (data.date != "") {
813
+ jQuery('.b2s-post-sched-area-sched-time[data-post-id="' + id + '"]').html(data.date);
814
+ }
815
+ jQuery('.b2s-post-edit-success').show();
816
+ wp.heartbeat.connectNow();
817
+ }
818
+ });
819
+ });
820
+ jQuery(document).on("click", ".release_locks", function () {
821
+ jQuery.ajax({
822
+ url: ajaxurl,
823
+ type: "POST",
824
+ cache: false,
825
+ async: false,
826
+ data: {
827
+ 'action': 'b2s_get_calendar_release_locks',
828
+ 'post_id': jQuery('#post_id').val()
829
+ },
830
+ success: function (data) {
831
+ wp.heartbeat.connectNow();
832
+ }
833
+ });
834
+ });
835
+
836
+
837
+
838
+ function showFilter(typ) {
839
+ if (typ == 'show') {
840
+ jQuery('.filterShow').hide();
841
+ jQuery('.form-inline').show();
842
+ jQuery('.filterHide').show();
843
+ } else {
844
+ jQuery('.filterShow').show();
845
+ jQuery('.form-inline').hide();
846
+ jQuery('.filterHide').hide();
847
+ }
848
+ }
849
+
850
+ function padDate(n) {
851
+ return ("0" + n).slice(-2);
852
+ }
853
+
854
+
855
+ function checkSchedDateTime() {
856
+ var dateElement = '#b2s-change-date';
857
+ var timeElement = '#b2s-change-time';
858
+ var dateStr = jQuery(dateElement).val();
859
+ var minStr = jQuery(timeElement).val();
860
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
861
+
862
+ if (jQuery('#b2sUserLang').val() == 'de') {
863
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
864
+ } else {
865
+ var minParts = minStr.split(' ');
866
+ var minParts2 = minParts[0].split(':');
867
+ if (minParts[1] == 'PM') {
868
+ minParts2[0] = parseInt(minParts2[0]) + 12;
869
+ }
870
+ minStr = minParts2[0] + ':' + minParts2[1];
871
+ }
872
+
873
+ var minParts3 = minStr.split(':');
874
+ if (minParts3[0] < 10) {
875
+ minParts3[0] = '0' + minParts3[0];
876
+ }
877
+ var dateParts = dateStr.split('-');
878
+
879
+ //utc current time
880
+ var now = new Date();
881
+ //offset between utc und user
882
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
883
+ //enter hour to user time
884
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
885
+ //calculate datetime in utc
886
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
887
+ //compare enter date time with allowed user time
888
+ if (enter.getTime() < now.getTime()) {
889
+ //enter set on next 15 minutes and calculate on user timezone
890
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
891
+ jQuery(dateElement).datepicker('update', enter);
892
+ jQuery(timeElement).timepicker('setTime', enter);
893
+ }
894
+ }
895
+
896
+
897
+ window.addEventListener('message', function (e) {
898
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
899
+ var data = JSON.parse(e.data);
900
+ if (data.action == 'approve') {
901
+ var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blog_post_id + '"]').html());
902
+ var newCount = count - 1;
903
+ jQuery('.b2s-approve-count[data-post-id="' + data.blog_post_id + '"]').html(newCount);
904
+ if (newCount >= 1) {
905
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').remove();
906
+ } else {
907
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').closest('ul').closest('li').remove();
908
+ }
909
+ jQuery.ajax({
910
+ url: ajaxurl,
911
+ type: "POST",
912
+ cache: false,
913
+ async: false,
914
+ data: {
915
+ 'action': 'b2s_update_approve_post',
916
+ 'post_id': data.post_id,
917
+ 'publish_link': data.publish_link,
918
+ 'publish_error_code': data.publish_error_code,
919
+ },
920
+ success: function (data) {
921
+
922
+ }
923
+ });
924
+ }
925
+ }
926
+ });
927
+
928
+ jQuery(document).on('click', '.deleteDraftBtn', function () {
929
+ jQuery('#b2s-delete-confirm-draft-id').val(jQuery(this).attr('data-b2s-draft-id'));
930
+ jQuery('.b2s-delete-draft-modal').modal('show');
931
+ });
932
+
933
+ jQuery(document).on('click', '.b2s-draft-delete-confirm-btn', function () {
934
+ jQuery.ajax({
935
+ url: ajaxurl,
936
+ type: "POST",
937
+ dataType: "json",
938
+ cache: false,
939
+ data: {
940
+ 'action': 'b2s_delete_user_draft',
941
+ 'draftId': jQuery('#b2s-delete-confirm-draft-id').val()
942
+ },
943
+ error: function () {
944
+ jQuery('.b2s-server-connection-fail').show();
945
+ return false;
946
+ },
947
+ success: function (data) {
948
+ jQuery('.b2s-delete-draft-modal').modal('hide');
949
+ if (data.result == true) {
950
+ jQuery('.b2s-draft-list-entry[data-b2s-draft-id="' + jQuery('#b2s-delete-confirm-draft-id').val() + '"]').remove();
951
+ jQuery('.b2s-post-remove-success').show();
952
+ } else {
953
+ jQuery('.b2s-post-remove-fail').show();
954
+ }
955
+ return true;
956
+ }
957
+ });
958
+ });
assets/js/b2s/ship.js CHANGED
@@ -1,3143 +1,3476 @@
1
- jQuery.noConflict();
2
-
3
- var b2sTosXingGroupCount = 0;
4
-
5
- jQuery(document).on('heartbeat-send', function (e, data) {
6
- data['b2s_heartbeat'] = 'b2s_listener';
7
- });
8
-
9
- jQuery.xhrPool = [];
10
-
11
- jQuery(window).on("load", function () {
12
- init(true);
13
- imageSize();
14
- if (jQuery('.toggelbutton').is(':visible') && !jQuery("#b2s-wrapper").hasClass("toggled")) {
15
- jQuery('.btn-toggle-menu').trigger('click');
16
- }
17
- });
18
-
19
- //Stop duplicate posts by page refreshing during the post process
20
- jQuery(document).on('keydown', '#b2sNetworkSent', function (event) {
21
- if (event.keyCode == 116) {
22
- event.preventDefault();
23
- return false;
24
- }
25
- });
26
-
27
- jQuery(document).on('click', '.btn-toggle-menu', function () {
28
- if (jQuery('.toggelbutton').is(':visible')) {
29
- jQuery("#b2s-wrapper").toggleClass("toggled");
30
- if (jQuery("#b2s-wrapper").hasClass("toggled")) {
31
- jQuery(".sidebar-brand").hide();
32
- jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-right').addClass('glyphicon-chevron-left');
33
- } else {
34
- jQuery(".sidebar-brand").show();
35
- jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-left').addClass('glyphicon-chevron-right');
36
- }
37
- }
38
- });
39
-
40
- jQuery.sceditor.plugins.xhtml.allowedTags = ['h1', 'h2', 'p', 'br', 'i', 'b', 'a', 'img'];
41
- jQuery.sceditor.command.set(
42
- "h1", {
43
- exec: function () {
44
- if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H1') {
45
- this.wysiwygEditorInsertHtml('<h1>', '</h1>');
46
- } else {
47
- jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
48
- }
49
- },
50
- txtExec: ["<h1>", "</h1>"],
51
- tooltip: "H1"
52
- });
53
- jQuery.sceditor.command.set(
54
- "h2", {
55
- exec: function () {
56
- if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H2') {
57
- this.wysiwygEditorInsertHtml('<h2>', '</h2>');
58
- } else {
59
- jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
60
- }
61
- },
62
- txtExec: ["<h2>", "</h2>"], tooltip: "H2"});
63
-
64
- jQuery.sceditor.command.set(
65
- "custom-image", {
66
- exec: function () {
67
- var me = this;
68
- if (typeof (b2s_is_calendar) != "undefined" && b2s_is_calendar)
69
- {
70
- jQuery('.b2s-network-select-image-content').html("");
71
- jQuery.ajax({
72
- url: ajaxurl,
73
- type: "POST",
74
- cache: false,
75
- async: false,
76
- data: {
77
- 'action': 'b2s_get_image_modal',
78
- 'id': b2s_current_post_id,
79
- 'image_url': ''
80
- },
81
- success: function (data) {
82
- jQuery(".b2s-network-select-image-content").html(data);
83
- }
84
- });
85
- }
86
- var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
87
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
88
- jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
89
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
90
- jQuery('.b2s-selected-network-for-image-info').html(content);
91
- jQuery('#b2s-network-select-image').modal('show');
92
- jQuery('#b2sInsertImageType').val("1");
93
- imageSize();
94
-
95
- },
96
- txtExec: function () {
97
- var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
98
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
99
- jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
100
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
101
- jQuery('.b2s-selected-network-for-image-info').html(content);
102
- jQuery('#b2s-network-select-image').modal('show');
103
- jQuery('#b2sInsertImageType').val("1");
104
- imageSize();
105
- }, tooltip: "Image"});
106
-
107
-
108
- jQuery(document).on('click', '.b2s-toogle-calendar-btn', function () {
109
-
110
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
111
- var networkId = jQuery(this).attr('data-network-id');
112
- var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
113
- var currentBtnText = jQuery(this).text();
114
-
115
- jQuery(this).text(toogleBtnText);
116
- jQuery(this).attr('data-toogle-text-btn', currentBtnText);
117
-
118
- //change to show
119
- var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
120
- if (calendar.hasClass('hide')) {
121
- calendar.removeClass('hide');
122
- calendar.addClass('show');
123
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').removeClass('hide');
124
-
125
- if (calendar.is(':empty')) {
126
- b2s_cur_source_ship_calendar[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + networkId + '&filter_status=2';
127
-
128
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar({
129
- editable: false,
130
- locale: b2s_calendar_locale,
131
- eventLimit: 2,
132
- contentHeight: 530,
133
- timeFormat: 'H:mm',
134
- eventSources: [b2s_cur_source_ship_calendar[0]],
135
- eventRender: function (event, element) {
136
- show = true;
137
- $header = jQuery("<div>").addClass("b2s-calendar-header");
138
- $isRelayPost = '';
139
- $isCuratedPost = '';
140
- if (event.post_type == 'b2s_ex_post') {
141
- $isCuratedPost = ' (Curated Post)';
142
- }
143
- if (event.relay_primary_post_id > 0) {
144
- $isRelayPost = ' (Retweet)';
145
- }
146
- $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
147
- element.find(".fc-time").after($network_name);
148
- element.html(element.html());
149
- $parent = element.parent();
150
- $header.append(element.find(".fc-content"));
151
- element.append($header);
152
- $body = jQuery("<div>").addClass("b2s-calendar-body");
153
- $body.append(event.avatar);
154
- $body.append(element.find(".fc-title"));
155
- $body.append(jQuery("<br>"));
156
- var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
157
- $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
158
- $em.append(event.network_name);
159
- $em.append(jQuery("<span>").text(": " + event.profile));
160
- $body.append($em);
161
- element.append($body);
162
- },
163
- dayRender: function (date, element) {
164
- if (!jQuery(element[0]).hasClass('fc-past')) {
165
- var date = jQuery(element[0]).attr('data-date');
166
- var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
167
- $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddSchedule").val() + "</span>").addClass("b2s-calendar-add-schedule-btn").attr('href', '#').attr('data-network-auth-id', networkAuthId);
168
- sel_element.append($header);
169
- }
170
- }
171
- });
172
- } else {
173
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar('refetchEvents');
174
- }
175
-
176
- } else {
177
- calendar.removeClass('show');
178
- calendar.addClass('hide');
179
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
180
-
181
- }
182
-
183
- return false;
184
-
185
- });
186
-
187
- jQuery(document).on('click', '.b2s-calendar-add-schedule-btn', function () {
188
- var selSchedDate = jQuery(this).parent('td').attr('data-date');
189
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
190
-
191
- if (jQuery('#user_version').val() == 0) {
192
- jQuery('.b2s-post-item-details-release-input-date-select-reset[data-network-auth-id="' + networkAuthId + '"]').val('0');
193
- jQuery('#b2s-sched-post-modal').modal('show');
194
- return false;
195
- }
196
-
197
- if (jQuery('#b2sUserLang').val() == 'de') {
198
- selSchedDate = selSchedDate.substring(8, 10) + '.' + selSchedDate.substring(5, 7) + '.' + selSchedDate.substring(0, 4);
199
- }
200
-
201
- //isfirst
202
- if (!jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"] option[value="1"]:selected').length > 0) {
203
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
204
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
205
- } else {
206
- //add
207
- var curSel = jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"]').filter(':visible');
208
- if (curSel.length > 0) {
209
- curSel.trigger('click');
210
- netCountNext = parseInt(curSel.attr('data-network-count')) + 1;
211
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + netCountNext + '"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
212
- } else {
213
- //do not adding write to first
214
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
215
- }
216
- }
217
- return false;
218
- });
219
-
220
- jQuery(document).on('change', '.b2s-calendar-filter-network-sel', function () {
221
- var newSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=2';
222
- var oldSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).attr('data-last-sel') + '&filter_status=2';
223
- jQuery(this).attr('data-last-sel', jQuery(this).val());
224
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('removeEventSource', oldSource);
225
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('addEventSource', newSource);
226
- return false;
227
- });
228
-
229
-
230
- jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
231
- jQuery('.b2s-server-connection-fail').hide();
232
- jQuery.ajax({
233
- url: ajaxurl,
234
- type: "POST",
235
- dataType: "json",
236
- cache: false,
237
- data: {
238
- 'action': 'b2s_get_settings_sched_time_default',
239
- },
240
- error: function () {
241
- jQuery('.b2s-server-connection-fail').show();
242
- return false;
243
- },
244
- success: function (data) {
245
- if (data.result == true) {
246
- var tomorrow = new Date();
247
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
248
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
249
- }
250
- tomorrow.setDate(tomorrow.getDate() + 1);
251
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
252
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
253
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
254
- var today = new Date();
255
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
256
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
257
- }
258
-
259
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
260
- var todayDate = ("0" + today.getDate()).slice(-2);
261
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
262
- var lang = jQuery('#b2sUserLang').val();
263
- if (lang == "de") {
264
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
265
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
266
- }
267
-
268
- jQuery.each(data.times, function (network_id, time) {
269
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
270
- time.forEach(function (network_type_time, count) {
271
- if (network_type_time != "") {
272
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
273
- if (jQuery(this).is(':not(:disabled)')) {
274
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
275
- //is not set special dates
276
- 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() == '0') {
277
- 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");
278
- }
279
- 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);
280
- 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);
281
- var hours = network_type_time.substring(0, 2);
282
- if (lang == "en") {
283
- var timeparts = network_type_time.split(' ');
284
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
285
- }
286
- if (hours < today.getHours()) {
287
- 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);
288
- 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);
289
- } else {
290
- 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);
291
- 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);
292
- }
293
- }
294
- });
295
- count++;
296
- }
297
- });
298
- }
299
- });
300
- }
301
- }
302
- });
303
- return false;
304
- });
305
-
306
-
307
- function formatAMPM(date) {
308
- var hours = date.getHours();
309
- var minutes = date.getMinutes();
310
- var ampm = hours >= 12 ? 'pm' : 'am';
311
- hours = hours % 12;
312
- hours = hours ? hours : 12; // the hour '0' should be '12'
313
- minutes = minutes < 10 ? '0' + minutes : minutes;
314
- var strTime = hours + ':' + minutes + ' ' + ampm;
315
- return strTime;
316
- }
317
-
318
-
319
-
320
- jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
321
- jQuery('#b2s-network-list-modal').modal('show');
322
- return false;
323
- });
324
- jQuery(document).on('click', '.change-meta-tag', function () {
325
- var attr = jQuery(this).attr('readonly');
326
- if (typeof attr !== typeof undefined && attr !== false) {
327
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
328
- //Content cuation
329
- var postType = jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-post-wp-type');
330
- if (postType != "ex") {
331
- jQuery('.meta-text').hide();
332
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
333
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
334
- var isMetaChecked = false;
335
- if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
336
- isMetaChecked = true;
337
- }
338
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
339
- isMetaChecked = true;
340
- }
341
- var showDefault = true;
342
- if (postFormat == "0" && !isMetaChecked) { //isLinkPost
343
- showDefault = false;
344
- if (networkId == "1") {
345
- jQuery('.isOgMetaChecked').show();
346
- } else {
347
- jQuery('.isCardMetaChecked').show();
348
- }
349
- }
350
- if (showDefault) {
351
- jQuery('.isLinkPost').show();
352
- }
353
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
354
- }
355
- }
356
- return false;
357
- });
358
- // Linkpost change Meta Tags title + desc
359
- jQuery(document).on('keyup', '.change-meta-tag', function () {
360
- var currentText = jQuery(this).val();
361
- var metaTag = jQuery(this).attr('data-meta');
362
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
363
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
364
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
365
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
366
- if (postFormat == "0") { //if linkpost
367
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
368
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
369
- //override this content with current content by keyup
370
- jQuery('.' + metaTag + '[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val(currentText);
371
- }
372
- });
373
- }
374
- }
375
- return false;
376
- });
377
- jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
378
- jQuery('.b2s-server-connection-fail').hide();
379
- jQuery.ajax({
380
- url: ajaxurl,
381
- type: "POST",
382
- dataType: "json",
383
- cache: false,
384
- data: {
385
- 'action': 'b2s_get_settings_sched_time_user',
386
- },
387
- error: function () {
388
- jQuery('.b2s-server-connection-fail').show();
389
- return false;
390
- },
391
- success: function (data) {
392
- var tomorrow = new Date();
393
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
394
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
395
- }
396
-
397
- tomorrow.setDate(tomorrow.getDate() + 1);
398
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
399
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
400
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
401
- var today = new Date();
402
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
403
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
404
- }
405
-
406
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
407
- var todayDate = ("0" + today.getDate()).slice(-2);
408
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
409
- var lang = jQuery('#b2sUserLang').val();
410
- if (lang == "de") {
411
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
412
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
413
- }
414
- if (data.result == true) {
415
- //V5.1.0 seeding
416
- if (data.type == 'new') {
417
- //new
418
- jQuery.each(data.times, function (network_auth_id, time) {
419
- if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
420
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
421
- //is not set special dates
422
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
423
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
424
- }
425
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
426
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', time);
427
- var hours = time.substring(0, 2);
428
- if (lang == "en") {
429
- var timeparts = time.split(' ');
430
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
431
- }
432
-
433
- var isDelay = false;
434
- var delayDay = data.delay_day[network_auth_id];
435
- if (delayDay != undefined) {
436
- if (delayDay > 0) {
437
- var delay = new Date();
438
- delay.setDate(today.getDate() + parseInt(delayDay));
439
- var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
440
- var delayDate = ("0" + delay.getDate()).slice(-2);
441
- var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
442
- if (lang == 'de') {
443
- dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
444
- }
445
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
446
- isDelay = true;
447
-
448
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
449
- }
450
- }
451
- if (!isDelay) {
452
- if (hours < today.getHours()) {
453
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
454
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
455
- } else {
456
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
457
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
458
- }
459
- }
460
- }
461
- }
462
- });
463
- } else {
464
- //old
465
- jQuery.each(data.times, function (network_id, time) {
466
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
467
- time.forEach(function (network_type_time, count) {
468
- if (network_type_time != "") {
469
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
470
- if (jQuery(this).is(':not(:disabled)')) {
471
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
472
- //is not set special dates
473
- 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') {
474
- 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");
475
- }
476
- 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);
477
- 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);
478
- var hours = network_type_time.substring(0, 2);
479
- if (lang == "en") {
480
- var timeparts = network_type_time.split(' ');
481
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
482
- }
483
- if (hours < today.getHours()) {
484
- 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);
485
- 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);
486
- } else {
487
- 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);
488
- 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);
489
- }
490
- }
491
- });
492
- count++;
493
- }
494
- });
495
- }
496
- });
497
- }
498
- } else {
499
- //default load best Times
500
- //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
501
- //set current time
502
- jQuery('.b2s-post-item:visible').each(function () {
503
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
504
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
505
- //is not set special dates
506
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
507
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
508
- }
509
- }
510
- });
511
- }
512
- }
513
- });
514
- return false;
515
- });
516
- jQuery('#b2sPreFeatureModal').on('show.bs.modal', function () {
517
- jQuery('.b2s-post-item-details-release-input-date-select-reset').val('0');
518
- });
519
- jQuery(document).on('click', '.b2s-network-list-add-btn-profeature', function () {
520
- jQuery('#b2s-network-list-modal').modal('hide');
521
- });
522
- jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all', function () {
523
- var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
524
- var dataNetworkCount = 0;
525
- var selMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val();
526
- if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="1"]').is(":visible")) {
527
- dataNetworkCount = 1;
528
- }
529
- if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="2"]').is(":visible")) {
530
- dataNetworkCount = 2;
531
- }
532
-
533
- jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
534
- if (jQuery(this).attr('data-network-auth-id') != dataNetworkAuthId && jQuery(this).has('option[value="' + jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val() + '"]').length > 0) {
535
- jQuery(this).val(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val());
536
- //view elements
537
- releaseChoose(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
538
- //view elements interval
539
- if (selMode == 2) {
540
- for (var i = 0; i <= dataNetworkCount; i++) {
541
- var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
542
- releaseChooseInterval(curInterval, '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]', i);
543
- }
544
- }
545
- }
546
- });
547
- //set values
548
- for (var i = 0; i <= dataNetworkCount; i++) {
549
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
550
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
551
- if (selMode == 2) {
552
- var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
553
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]').val(curInterval);
554
- if (curInterval == 0) {
555
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
556
- jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
557
- jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
558
- jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
559
- jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
560
- jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
561
- jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
562
- jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
563
- }
564
- if (curInterval == 1) {
565
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
566
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
567
- }
568
- if (curInterval == 2) {
569
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
570
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
571
- }
572
- }
573
- }
574
-
575
- if (dataNetworkCount == 2) {
576
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
577
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
578
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
579
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
580
- } else if (dataNetworkCount == 1) {
581
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
582
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
583
- }
584
-
585
- return false;
586
- });
587
- jQuery(document).on("click", ".b2s-user-network-settings-post-format", function () {
588
- jQuery('.b2s-settings-user-success').hide();
589
- jQuery('.b2s-settings-user-error').hide();
590
- jQuery('.b2s-server-connection-fail').hide();
591
- var networkId = jQuery(this).attr("data-network-id");
592
- var networkType = jQuery(this).attr("data-network-type");
593
- var postFormat = jQuery(this).val();
594
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
595
- var postFormatType = jQuery(this).attr("data-post-format-type");
596
- var postType = jQuery(this).attr("data-post-wp-type");
597
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
598
- //PostFormat
599
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
600
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
601
- if (jQuery('#user_version').val() >= 2) {
602
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][postFormat]);
603
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
604
- } else {
605
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][postFormat]);
606
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
607
- }
608
- }
609
-
610
- //Edit Meta Tags
611
- var isMetaChecked = false;
612
- if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
613
- isMetaChecked = true;
614
- }
615
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
616
- isMetaChecked = true;
617
- }
618
- if (isMetaChecked && postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
619
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
620
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
621
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
622
- if (dataMetaType == "og") {
623
- jQuery('#b2sChangeOgMeta').val("1");
624
- } else {
625
- jQuery('#b2sChangeCardMeta').val("1");
626
- }
627
-
628
- //Copy from further item meta tags by same network
629
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
630
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
631
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
632
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
633
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
634
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
635
- if (jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]:visible').length == 1) {
636
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
637
- } else {
638
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
639
- }
640
-
641
- return true;
642
- }
643
- });
644
-
645
- //Set & Check Link
646
- if (typeof jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]') !== undefined) {
647
- //Facebook + Twitter && Linkpost
648
- if (networkId == 1 || networkId == 2 && postFormat == 0) {
649
- if (jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
650
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefault_url').val());
651
- }
652
- }
653
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
654
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
655
- }
656
-
657
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
658
- if (networkId == 1 && networkType == 0) {
659
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
660
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
661
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
662
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
663
-
664
- }
665
-
666
- } else {
667
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
668
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
669
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
670
-
671
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
672
- if (networkId == 1 && networkType == 0) {
673
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
674
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').hide();
675
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').hide();
676
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').show();
677
- }
678
- }
679
-
680
- //Content Curation V5.0.0
681
- if (postType == "ex") {
682
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
683
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
684
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
685
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
686
- if (postFormat == '0') {
687
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
688
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
689
- } else {
690
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
691
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
692
- }
693
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
694
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
695
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
696
- }
697
- }
698
-
699
- if (networkId == "3") {
700
- if (postFormat == '0' && jQuery('#user_version').val() > 0) {
701
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
702
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
703
- jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').show();
704
- jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide(); //not showing on linkedin
705
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
706
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
707
- } else {
708
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
709
- jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').hide();
710
- jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
711
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
712
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
713
- }
714
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
715
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
716
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
717
- }
718
- }
719
-
720
-
721
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
722
- jQuery(this).addClass('b2s-settings-checked');
723
- jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
724
- return false;
725
- });
726
- jQuery(document).on("click", ".b2s-post-ship-item-full-text", function () {
727
- jQuery('.b2s-server-connection-fail').hide();
728
- var curSchedCount = jQuery(this).attr('data-network-count');
729
- jQuery.ajax({
730
- url: ajaxurl,
731
- type: "POST",
732
- dataType: "json",
733
- cache: false,
734
- data: {
735
- 'action': 'b2s_ship_item_full_text',
736
- 'postId': jQuery('#b2sPostId').val(),
737
- 'userLang': jQuery('#b2sUserLang').val(),
738
- 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
739
- 'networkId': jQuery(this).attr('data-network-id'),
740
- },
741
- error: function () {
742
- jQuery('.b2s-server-connection-fail').show();
743
- return false;
744
- },
745
- success: function (data) {
746
- if (data.result == true) {
747
- messageInput = jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + curSchedCount + '"][data-network-auth-id="' + data.networkAuthId + '"]');
748
- messageInput.val(data.text);
749
- networkCount(data.networkAuthId);
750
- networkTextLimit = messageInput.attr('data-network-text-limit');
751
- if (typeof networkTextLimit != undefined) {
752
- if (parseInt(networkTextLimit) > 0 && parseInt(data.networkId) > 0) {
753
- networkLimitAll(data.networkAuthId, data.networkId, networkTextLimit);
754
- }
755
- }
756
- }
757
- }
758
- });
759
- return false;
760
- });
761
- jQuery(document).on("click", ".b2s-post-ship-item-message-delete", function () {
762
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
763
- var networkCountId = jQuery(this).attr('data-network-count');
764
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
765
- initSceditor(networkAuthId);
766
- networkCount(networkAuthId);
767
- return false;
768
- });
769
- jQuery(document).on("click", ".b2s-post-ship-item-copy-original-text", function () {
770
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
771
- var networkCountId = jQuery(this).attr('data-network-count');
772
- var networkId = jQuery(this).attr('data-network-id');
773
- var text = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').val();
774
- if (text == "" && networkId == 2) {
775
- text = jQuery('#b2sTwitterOrginalPost').val();
776
- }
777
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(text);
778
- networkCount(networkAuthId);
779
- return false;
780
- });
781
- jQuery(document).on("click", ".b2s-network-select-btn", function () {
782
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
783
- var networkId = jQuery(this).attr('data-network-id');
784
- var networkType = jQuery(this).attr('data-network-type');
785
-
786
- //doppelklick Schutz
787
- if (!jQuery(this).hasClass('b2s-network-select-btn-deactivate')) {
788
- //active?
789
- if (!jQuery(this).children().hasClass('active')) {
790
- //TOS XING Groups
791
- if ((networkId == 8 || networkId == 19) && networkType == 2) {
792
- if ((b2sTosXingGroupCount == jQuery('#b2sTosXingGroupCrosspostingLimit').val()) || (networkId == 19 && jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-tos-group-id="' + jQuery(this).attr('data-network-tos-group-id') + '"]').children().hasClass('active'))) {
793
- jQuery('#b2s-tos-xing-group-modal').modal('show');
794
- return false;
795
- } else {
796
- b2sTosXingGroupCount++;
797
- }
798
- }
799
- //schon vorhanden?
800
- if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').length > 0 && !jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').hasClass('b2s-post-item-connection-fail-dummy')) {
801
- activatePortal(networkAuthId);
802
- //PostFormat
803
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
804
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
805
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').attr('data-post-format-type');
806
- if (jQuery('#user_version').val() >= 2) {
807
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
808
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
809
- //if linkpost then show btn meta tags
810
- var isMetaChecked = false;
811
- if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
812
- isMetaChecked = true;
813
- }
814
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
815
- isMetaChecked = true;
816
- }
817
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
818
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
819
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
820
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
821
- if (dataMetaType == "og") {
822
- jQuery('#b2sChangeOgMeta').val("1");
823
- } else {
824
- jQuery('#b2sChangeCardMeta').val("1");
825
- }
826
-
827
- //Copy from further item meta tags by same network
828
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
829
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
830
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
831
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
832
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
833
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
834
- if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
835
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
836
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
837
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
838
- }
839
- } else {
840
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
841
- }
842
-
843
- return true;
844
- }
845
- });
846
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
847
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
848
- } else {
849
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
850
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
851
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
852
- }
853
-
854
- if (networkId == "3") {
855
- if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
856
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
857
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
858
- jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').show();
859
- jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide(); //not showing on linkedin
860
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
861
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
862
- } else {
863
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
864
- jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').hide();
865
- jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
866
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
867
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
868
- }
869
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
870
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
871
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
872
- }
873
- }
874
-
875
- } else {
876
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
877
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
878
- }
879
-
880
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
881
- if (networkId == 1 && networkType == 0) {
882
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == "1") {
883
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
884
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').hide();
885
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').hide();
886
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').show();
887
- } else {
888
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
889
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
890
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
891
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
892
- }
893
- }
894
-
895
- //Content Curation
896
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + networkAuthId + '"]').attr('data-post-wp-type') == 'ex') {
897
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
898
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
899
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
900
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
901
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 0) {
902
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
903
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
904
- } else {
905
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
906
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
907
- }
908
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
909
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
910
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
911
- }
912
- }
913
- }
914
-
915
- //XING TOS Group
916
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"').show();
917
-
918
- //Twitter TOS 032018 - protected multiple accounts with same content to same time
919
- //delete comment field one more
920
- if (networkId == 2) {
921
- if (jQuery('.tw-textarea-input[data-network-id="' + networkId + '"]:visible').length == 1) {
922
- jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text(jQuery('#b2sTwitterOrginalPost').val());
923
- } else {
924
- jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text("");
925
- }
926
- }
927
-
928
- } else {
929
- jQuery(this).addClass('b2s-network-select-btn-deactivate');
930
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').show();
931
- jQuery('.b2s-empty-area').hide();
932
- loadingDummyShow(networkAuthId, jQuery(this).attr('data-network-id'));
933
- jQuery('.b2s-server-connection-fail').hide();
934
- var networkId = jQuery(this).attr('data-network-id');
935
- var legacyMode = jQuery('#isLegacyMode').val();
936
- if (legacyMode == "1") {
937
- legacyMode = false; // loading is sync (stack)
938
- } else {
939
- legacyMode = true; // loading is async (parallel)
940
- }
941
- jQuery.ajax({
942
- url: ajaxurl,
943
- type: "POST",
944
- dataType: "json",
945
- async: legacyMode,
946
- cache: false,
947
- data: {
948
- 'action': 'b2s_ship_item',
949
- 'networkAuthId': networkAuthId,
950
- 'networkType': jQuery(this).attr('data-network-type'),
951
- 'networkKind': jQuery(this).attr('data-network-kind'),
952
- 'networkId': networkId,
953
- 'networkDisplayName': jQuery(this).attr('data-network-display-name'),
954
- 'instantSharing': jQuery(this).attr('data-instant-sharing'),
955
- 'networkTosGroupId': jQuery(this).attr('data-network-tos-group-id'),
956
- 'userLang': jQuery('#b2sUserLang').val(),
957
- 'postId': jQuery('#b2sPostId').val(),
958
- 'relayCount': jQuery('#b2sRelayCount').val(),
959
- 'selSchedDate': jQuery('#selSchedDate').val(),
960
- 'b2sPostType': jQuery('#b2sPostType').val()
961
- },
962
- beforeSend: function (jqXHR) { // before jQuery send the request we will push it to our array
963
- jQuery.xhrPool.push(jqXHR);
964
- },
965
- complete: function (jqXHR) { // when some of the requests completed it will splice from the array
966
- var index = jQuery.xhrPool.indexOf(jqXHR);
967
- if (index > -1) {
968
- jQuery.xhrPool.splice(index, 1);
969
- }
970
- },
971
- error: function (jqXHR) {
972
- var index = jQuery.xhrPool.indexOf(jqXHR);
973
- if (index > -1) {
974
- jQuery.xhrPool.splice(index, 1);
975
- }
976
- loadingDummyConnectionFail(networkAuthId, networkId);
977
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').hide();
978
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
979
- jQuery('.b2s-server-connection-fail').show();
980
- return true;
981
- },
982
- success: function (data) {
983
- if (data != undefined) {
984
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + data.networkAuthId + '"]').hide();
985
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
986
- if (data.result == true) {
987
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
988
- var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
989
- var pos = order.indexOf(data.networkAuthId.toString());
990
- var add = false;
991
- for (var i = pos; i >= 0; i--) {
992
- if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
993
- jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(data.content);
994
- i = -1;
995
- add = true;
996
- }
997
- }
998
- if (add == false) {
999
- jQuery('.b2s-post-list').prepend(data.content);
1000
- }
1001
-
1002
- activatePortal(data.networkAuthId);
1003
- var dateFormat = "yyyy-mm-dd";
1004
- var language = "en";
1005
- var showMeridian = true;
1006
- if (jQuery('#b2sUserLang').val() == "de") {
1007
- dateFormat = "dd.mm.yyyy";
1008
- language = "de";
1009
- showMeridian = false;
1010
- }
1011
- var today = new Date();
1012
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
1013
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
1014
- }
1015
-
1016
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
1017
- format: dateFormat,
1018
- language: language,
1019
- maxViewMode: 2,
1020
- todayHighlight: true,
1021
- startDate: today,
1022
- calendarWeeks: true,
1023
- autoclose: true
1024
- });
1025
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
1026
- minuteStep: 15,
1027
- appendWidgetTo: 'body',
1028
- showSeconds: false,
1029
- showMeridian: showMeridian,
1030
- defaultTime: today, //'current',
1031
- snapToStep: true
1032
- });
1033
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
1034
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1035
- });
1036
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
1037
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1038
- });
1039
- //Check Text Limit
1040
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-text-limit');
1041
- if (textLimit != "0") {
1042
- networkLimitAll(data.networkAuthId, data.networkId, textLimit);
1043
- } else {
1044
- networkCount(data.networkAuthId);
1045
- }
1046
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
1047
- initSceditor(data.networkAuthId);
1048
- //Bild setzen
1049
- if (jQuery('#b2s_blog_default_image').val() != "") {
1050
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').length > 0) {
1051
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
1052
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1053
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1054
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="0"]').show();
1055
- } else {
1056
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1057
- }
1058
- }
1059
- jQuery('.b2s-image-url-hidden-field').val(jQuery('#b2s_blog_default_image').val());
1060
- }
1061
-
1062
- //Time zone
1063
- jQuery('.b2s-settings-time-zone-text').html(jQuery('#user_timezone_text').val());
1064
- //PostFormat
1065
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0) {
1066
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
1067
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').attr('data-post-format-type');
1068
- if (jQuery('#user_version').val() >= 2) {
1069
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + data.networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
1070
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
1071
- var isMetaChecked = false;
1072
- if (data.networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
1073
- isMetaChecked = true;
1074
- }
1075
- if (data.networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1076
- isMetaChecked = true;
1077
- }
1078
-
1079
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1080
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1081
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1082
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
1083
- if (dataMetaType == "og") {
1084
- jQuery('#b2sChangeOgMeta').val("1");
1085
- } else {
1086
- jQuery('#b2sChangeCardMeta').val("1");
1087
- }
1088
-
1089
- //Copy from further item meta tags by same network
1090
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + data.networkId + ']').each(function () {
1091
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != data.networkAuthId) { //other Linkpost by same network
1092
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1093
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1094
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
1095
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1096
-
1097
- if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
1098
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1099
- } else {
1100
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1101
- }
1102
- return true;
1103
- }
1104
- });
1105
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1106
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1107
- } else {
1108
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1109
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1110
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1111
- }
1112
-
1113
- if (data.networkId == "3") {
1114
- if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1115
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1116
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1117
- jQuery('.linkedin-url-title[data-network-auth-id="' + data.networkAuthId + '"]').show();
1118
- jQuery('.linkedin-url-desc[data-network-auth-id="' + data.networkAuthId + '"]').hide(); // not showing on linkedin
1119
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1120
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1121
- } else {
1122
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1123
- jQuery('.linkedin-url-title[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1124
- jQuery('.linkedin-url-desc[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1125
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1126
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1127
- }
1128
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1129
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1130
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1131
- }
1132
- }
1133
-
1134
- } else {
1135
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + data.networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
1136
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
1137
- }
1138
-
1139
-
1140
- if (jQuery('#selSchedDate').val() != "") {
1141
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1142
- }
1143
-
1144
-
1145
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
1146
- if (data.networkId == 1 && data.networkType == 0) {
1147
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == "1") {
1148
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1149
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').hide();
1150
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').hide();
1151
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + data.networkAuthId + '"]').show();
1152
- } else {
1153
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1154
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
1155
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
1156
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1157
- }
1158
- }
1159
-
1160
- //Twitter TOS 032018 - protected multiple accounts with same content to same time
1161
- //delete comment field one more
1162
- if (data.networkId == 2) {
1163
- if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length > 1) {
1164
- var firstAuth = jQuery('.b2s-post-item[data-network-id="' + data.networkId + '"]:first').attr('data-network-auth-id');
1165
- if (firstAuth != data.networkAuthId) {
1166
- jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1167
- } else {
1168
- if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length > 2) {
1169
- jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1170
- }
1171
- }
1172
- } else {
1173
- //set original post
1174
- jQuery('#b2sTwitterOrginalPost').val(jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').val());
1175
- }
1176
- }
1177
-
1178
- //Content Curation
1179
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-post-wp-type') == 'ex') {
1180
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1181
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1182
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1183
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + data.networkAuthId + '"]').attr("style", "display:none !important");
1184
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == 0) {
1185
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1186
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1187
- } else {
1188
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1189
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1190
- }
1191
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1192
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1193
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1194
- }
1195
- }
1196
-
1197
- }
1198
-
1199
- //XING Groups
1200
- if (data.networkId == 19 && data.networkType == 2) {
1201
- if (jQuery('.networkKind[data-network-auth-id="' + data.networkAuthId + '"]').val() == '3') {
1202
- jQuery('.marketplace_area[data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + data.networkId + '"]').show();
1203
- }
1204
- }
1205
- //XING TOS Group
1206
- jQuery('.b2s-content-info[data-network-auth-id="' + data.networkAuthId + '"').show();
1207
- } else {
1208
- //TOS XING Groups
1209
- if (typeof data.reason !== "undefined") {
1210
- if (data.reason == 'tos_xing_group_exists') {
1211
- b2sTosXingGroupCount--;
1212
- deactivatePortal(data.networkAuthId);
1213
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1214
- jQuery('#b2s-tos-xing-group-modal').modal('show');
1215
- return false;
1216
- }
1217
-
1218
- }
1219
-
1220
- }
1221
- }
1222
- }
1223
- });
1224
- }
1225
- } else {
1226
- //TOS XING Groups
1227
- if ((networkId == 8 || networkId == 19) && networkType == 2) {
1228
- b2sTosXingGroupCount--;
1229
- }
1230
- deactivatePortal(networkAuthId);
1231
- }
1232
- }
1233
- return false;
1234
- });
1235
- jQuery(document).on('click', '.b2s-post-item-details-url-image', function () {
1236
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
1237
- var networkCountId = jQuery(this).attr("data-network-count");
1238
- if (jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').is(":visible")) {
1239
-
1240
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1241
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
1242
- var isMetaChecked = false;
1243
- if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
1244
- isMetaChecked = true;
1245
- }
1246
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1247
- isMetaChecked = true;
1248
- }
1249
-
1250
- if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Faceboo or Twitter
1251
- jQuery('.meta-text').hide();
1252
- if (!isMetaChecked) {
1253
- if (networkId == "1") {
1254
- jQuery('.isOgMetaChecked').show();
1255
- } else {
1256
- jQuery('.isCardMetaChecked').show();
1257
- }
1258
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1259
- return false;
1260
- }
1261
- }
1262
-
1263
- jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1264
- }
1265
- return false;
1266
- });
1267
- jQuery(document).on('click', '.b2s-submit-btn-scroll', function () {
1268
- jQuery('.b2s-submit-btn').trigger('click');
1269
- });
1270
- jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
1271
- if (jQuery('#user_version').val() >= 1) {
1272
- jQuery('.b2s-user-network-settings-post-format-area').hide();
1273
- jQuery('.b2s-user-network-settings-post-format-area[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1274
- jQuery('#b2s-post-ship-item-post-format-network-title').html(jQuery('.b2s-user-network-settings-post-format-area[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').attr('data-network-title'));
1275
- if (jQuery('#user_version').val() >= 2) {
1276
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').removeClass('b2s-settings-checked');
1277
- var currentPostFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
1278
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"][data-post-format="' + currentPostFormat + '"]').addClass('b2s-settings-checked');
1279
- jQuery('#b2s-post-ship-item-post-format-network-display-name').html(jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').text().toUpperCase());
1280
- }
1281
- jQuery('.b2s-post-format-settings-info').hide();
1282
- jQuery('.b2s-post-format-settings-info[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1283
- jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
1284
- jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
1285
- jQuery('.b2s-user-network-settings-post-format').attr('data-post-wp-type', jQuery(this).attr('data-post-wp-type'));
1286
- } else {
1287
- jQuery('#b2sInfoFormatModal').modal('show');
1288
- }
1289
- return false;
1290
- });
1291
- jQuery(document).on('click', '.b2s-btn-trigger-post-ship-item-post-format', function () {
1292
- jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1293
- return false;
1294
- });
1295
- jQuery(document).on('click', '.b2s-post-item-details-release-input-days', function () {
1296
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1297
- });
1298
- jQuery(document).on('change', '.b2s-post-item-details-release-input-time', function () {
1299
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1300
- });
1301
- jQuery(document).on('change', '.b2s-post-item-details-release-input-date', function () {
1302
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1303
- });
1304
- jQuery('.b2s-network-details-mandant-select').change(function () {
1305
- hideDuplicateAuths();
1306
- chooseMandant();
1307
- });
1308
- jQuery(document).on('change', '.b2s-post-item-details-item-group-select', function () {
1309
- if (jQuery(this).attr('data-change-network-display-name') == 'true') {
1310
- var label = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
1311
- jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').html(label);
1312
- jQuery('.b2s-post-ship-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(label);
1313
- }
1314
- //Xing groups
1315
- if (jQuery(this).attr('data-network-id') == '19') {
1316
- var option = jQuery('option:selected', this).attr('data-network-kind');
1317
- if (option == '3') { //Marketplace
1318
- jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1319
- } else {
1320
- jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').hide();
1321
- }
1322
- jQuery('.networkKind[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(option);
1323
- }
1324
-
1325
- return false;
1326
- });
1327
- //select recurrent sched interval mode
1328
- jQuery(document).on('change', '.b2s-post-item-details-release-input-interval-select', function () {
1329
- var interval = jQuery(this).val();
1330
- var selectorInput = '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
1331
- var dataCount = jQuery(this).attr('data-network-count');
1332
- releaseChooseInterval(interval, selectorInput, dataCount);
1333
- return false;
1334
- });
1335
- //select shipping mode
1336
- jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select', function () {
1337
- var dataNetworkCount = 0;
1338
- if (jQuery(this).val() == 0) {
1339
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1340
- if (jQuery(this).attr('data-network-id') == 2) {
1341
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1342
- }
1343
- }
1344
- if (jQuery(this).val() == 2) {
1345
- if (jQuery(this).attr('data-user-version') == 0) {
1346
- jQuery('#b2s-sched-post-modal').modal('show');
1347
- return false;
1348
- } else {
1349
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1350
- if (jQuery(this).attr('data-network-id') == 2) {
1351
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1352
- }
1353
-
1354
- for (var i = 1; i <= 2; i++) {
1355
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + i + '"]').each(function () {
1356
- if (jQuery(this).prop('checked')) {
1357
- dataNetworkCount = 1;
1358
- }
1359
- });
1360
- }
1361
- if (dataNetworkCount == 2) {
1362
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1363
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1364
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1365
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1366
- } else if (dataNetworkCount == 1) {
1367
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1368
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1369
- }
1370
- }
1371
- }
1372
- if (jQuery(this).val() == 1) {
1373
- if (jQuery(this).attr('data-user-version') == 0) {
1374
- jQuery('#b2s-sched-post-modal').modal('show');
1375
- return false;
1376
- } else {
1377
-
1378
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1379
- if (jQuery(this).attr('data-network-id') == 2) {
1380
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1381
- } else {
1382
- //set orginal edit content for customize sched content
1383
- var content = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').val();
1384
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(content);
1385
-
1386
- }
1387
-
1388
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1389
- if (dataNetworkCount == 2) {
1390
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1391
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1392
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1393
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1394
- } else if (dataNetworkCount == 1) {
1395
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1396
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1397
- }
1398
- }
1399
- }
1400
- releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1401
- });
1402
- jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
1403
- jQuery('#b2sSchedPostInfoIgnore').val("1");
1404
- jQuery('.b2s-submit-btn').trigger("click");
1405
- return false;
1406
- });
1407
- jQuery(document).on('click', '.b2s-re-share-btn', function () {
1408
- jQuery('.panel-group').removeClass('b2s-border-color-warning');
1409
- jQuery(".b2s-settings-user-sched-time-area").show();
1410
- jQuery('#b2s-sidebar-wrapper').show();
1411
- jQuery('.b2s-post-item-info-area').show();
1412
- jQuery('.b2s-post-item-details-message-info').show();
1413
- jQuery('.b2s-post-item-details-edit-area').show();
1414
- jQuery('.b2s-post-item-details-message-result').hide();
1415
- jQuery('.b2s-post-item-details-message-result').html("");
1416
- jQuery(".b2s-post-area").show();
1417
- jQuery('.b2s-publish-area').show();
1418
- jQuery('.b2s-footer-menu').show();
1419
- window.scrollTo(0, 0);
1420
- jQuery('.b2s-reporting-btn-area').hide();
1421
- jQuery('#b2sSchedPostInfoIgnore').val("0");
1422
- //Calendar close for resfresh
1423
- jQuery('.b2s-toogle-calendar-btn').each(function () {
1424
- if (!jQuery(this).hasClass('hide')) {
1425
- var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
1426
- var currentBtnText = jQuery(this).text();
1427
- jQuery(this).text(toogleBtnText);
1428
- jQuery(this).attr('data-toogle-text-btn', currentBtnText);
1429
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1430
- var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
1431
- calendar.removeClass('show');
1432
- calendar.addClass('hide');
1433
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
1434
- }
1435
- });
1436
-
1437
- //TOS XING Group
1438
- jQuery('.b2s-network-select-btn').each(function () {
1439
- if (jQuery(this).children().hasClass('active')) {
1440
- if (jQuery(this).attr('data-network-id') == "19" && jQuery(this).attr('data-network-type') == "2") {
1441
- b2sTosXingGroupCount--;
1442
- deactivatePortal(jQuery(this).attr('data-network-auth-id'));
1443
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-network-select-btn-deactivate');
1444
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
1445
- }
1446
- }
1447
- });
1448
-
1449
- //Approve
1450
- jQuery('.b2s-post-item-details-post-format').each(function () {
1451
- if (jQuery(this).attr('data-network-id') == "1" && jQuery(this).attr('data-network-type') == '0' && jQuery(this).val() == "1") {
1452
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').show();
1453
- }
1454
- });
1455
-
1456
- return false;
1457
- });
1458
- jQuery(document).on('click', '.b2s-post-item-details-release-input-add', function () {
1459
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1460
- var netCount = jQuery(this).attr('data-network-count');
1461
- var networkId = jQuery(this).attr('data-network-id');
1462
- var networkType = jQuery(this).attr('data-network-type');
1463
- var netCountNext = parseInt(netCount) + 1;
1464
- var curMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val();
1465
- jQuery(this).hide();
1466
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]').hide();
1467
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1468
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1469
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1470
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1471
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1472
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1473
-
1474
- if (curMode == 1) {
1475
- //since 4.9.0 custom content
1476
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1477
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1478
- }
1479
- //recurrently
1480
- if (curMode == 2) {
1481
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1482
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1483
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1484
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1485
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1486
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1487
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').val('1');
1488
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1489
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1490
- //since 4.9.0 custom content
1491
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').hide();
1492
- }
1493
-
1494
- return false;
1495
- });
1496
- jQuery(document).on('click', '.b2s-post-item-details-release-input-hide', function () {
1497
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1498
- var netCount = jQuery(this).attr('data-network-count');
1499
- var netCountBevor = parseInt(netCount) - 1;
1500
- var selectorInput = '[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]'
1501
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
1502
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1503
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1504
- //clean all fields
1505
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
1506
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
1507
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).val('');
1508
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
1509
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('checked', false);
1510
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
1511
- //since 4.9.0 custom content
1512
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput).prop('disabled', true);
1513
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput).removeClass('error');
1514
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
1515
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
1516
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
1517
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
1518
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
1519
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled', true);
1520
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).val("1");
1521
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
1522
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled', true);
1523
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).val("1");
1524
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
1525
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
1526
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled', true);
1527
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).val("1");
1528
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
1529
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled', true);
1530
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).val("1");
1531
- return false;
1532
- });
1533
- jQuery(document).on("keyup", ".complete_network_url", function () {
1534
- var url = jQuery(this).val();
1535
- jQuery(this).removeClass("error");
1536
- if (url.length != "0") {
1537
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
1538
- url = "http://" + url;
1539
- jQuery(this).val(url);
1540
- }
1541
- } else if (jQuery(this).hasClass("required_network_url")) {
1542
- if (!(jQuery(this).attr('data-network-id') == 1 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == 1)) { //Facebook Imagepost don't require Link
1543
- url = jQuery("#b2sDefault_url").val();
1544
- jQuery(this).val(url);
1545
- }
1546
- }
1547
- });
1548
- jQuery(document).on('click', '.scroll-to-top', function () {
1549
- window.scrollTo(0, 0);
1550
- return false;
1551
- });
1552
- jQuery(document).on('click', '.scroll-to-bottom', function () {
1553
- window.scrollTo(0, document.body.scrollHeight);
1554
- return false;
1555
- });
1556
- jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', function () {
1557
- var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/);
1558
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1559
- var url = jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val();
1560
- if (re.test(url)) {
1561
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
1562
- jQuery(this).addClass('glyphicon-refresh-animate');
1563
- jQuery('.b2s-server-connection-fail').hide();
1564
- jQuery.ajax({
1565
- url: ajaxurl,
1566
- type: "POST",
1567
- dataType: "json",
1568
- cache: false,
1569
- data: {
1570
- 'action': 'b2s_ship_item_reload_url',
1571
- 'networkId': jQuery(this).attr('data-network-id'),
1572
- 'networkAuthId': networkAuthId,
1573
- 'postId': jQuery('#b2sPostId').val(),
1574
- 'defaultUrl': jQuery('#b2sDefault_url').val(),
1575
- 'url': url
1576
- },
1577
- error: function () {
1578
- jQuery('.b2s-server-connection-fail').show();
1579
- return false;
1580
- },
1581
- success: function (data) {
1582
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1583
- if (data.result == true) {
1584
- if (data.networkId == 3 || data.networkId == 19) { // LI,XI
1585
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').html(data.title);
1586
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').html(data.description);
1587
- } else {
1588
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1589
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1590
- }
1591
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1592
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1593
- }
1594
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '1') {
1595
- if (data.image != "") {
1596
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1597
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(data.image);
1598
- } else {
1599
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1600
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1601
- }
1602
- }
1603
- }
1604
- }
1605
-
1606
- });
1607
- } else {
1608
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
1609
- }
1610
- });
1611
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1612
- var metaType = jQuery(this).attr('data-meta-type');
1613
- var authId = jQuery(this).attr('data-network-auth-id');
1614
- var countId = jQuery(this).attr('data-network-count');
1615
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').val();
1616
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').attr("data-network-id");
1617
- var isMetaChecked = false;
1618
- if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
1619
- isMetaChecked = true;
1620
- }
1621
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1622
- isMetaChecked = true;
1623
- }
1624
-
1625
- if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Facebook or Twitter
1626
- jQuery('.meta-text').hide();
1627
- if (!isMetaChecked) {
1628
- if (networkId == "1") {
1629
- jQuery('.isOgMetaChecked').show();
1630
- } else {
1631
- jQuery('.isCardMetaChecked').show();
1632
- }
1633
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1634
- return false;
1635
- }
1636
- }
1637
-
1638
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId);
1639
- jQuery('.b2s-image-change-all-network').attr('data-network-count', countId).attr('data-network-id', networkId);
1640
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId).attr('data-network-count', countId);
1641
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
1642
- jQuery('.b2s-selected-network-for-image-info').html(content);
1643
- jQuery('#b2sInsertImageType').val("0");
1644
- if (typeof metaType !== 'undefined') {
1645
- jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1646
- } else {
1647
- jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1648
- }
1649
- //set selected image
1650
- var selImageVal = jQuery('.b2s-post-item-details-url-image[data-network-count="' + countId + '"][data-network-auth-id="' + authId + '"]').attr('src');
1651
- jQuery('#b2s-network-select-image').modal('show');
1652
- jQuery('.checkNetworkImage[data-src="' + selImageVal + '"]').attr('checked', 'checked');
1653
- imageSize();
1654
- return false;
1655
- });
1656
- jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1657
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1658
- var networkCountId = jQuery(this).attr('data-network-count');
1659
- var defaultImage = jQuery('#b2sDefaultNoImage').val();
1660
- //default
1661
- if (networkCountId == -1) {
1662
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1663
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1664
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1665
- } else {
1666
- //customize sched content
1667
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1668
- jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
1669
- jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').hide();
1670
- }
1671
-
1672
- //add check linkpost change meta tag image for this network
1673
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1674
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1675
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
1676
- if (postFormat == "0") { //if linkpost
1677
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1678
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1679
- //override this image with current image
1680
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1681
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1682
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1683
- }
1684
- });
1685
- //customize sched content
1686
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1687
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1688
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1689
- }
1690
- }
1691
-
1692
- return false;
1693
- });
1694
- jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1695
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1696
- var networkCountId = jQuery(this).attr('data-network-count');
1697
- var networkId = jQuery(this).attr('data-network-id');
1698
- var currentImage = jQuery('input[name=image_url]:checked').val();
1699
- if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1700
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1701
- sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1702
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1703
- } else {
1704
- //default
1705
- if (networkCountId == -1) {
1706
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1707
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1708
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1709
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1710
- } else {
1711
- //customize sched content
1712
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1713
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1714
- jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1715
- jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').show();
1716
- }
1717
-
1718
- if (jQuery(this).attr('data-meta-type') == "og") {
1719
- jQuery('#b2sChangeOgMeta').val("1");
1720
- }
1721
- if (jQuery(this).attr('data-meta-type') == "card") {
1722
- jQuery('#b2sChangeCardMeta').val("1");
1723
- }
1724
-
1725
- //add check linkpost change meta tag image for this network
1726
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1727
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1728
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
1729
- if (networkId != 12) { // ignore for instagram
1730
- if (postFormat == "0") { //if linkpost
1731
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1732
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1733
- //override this image with current image
1734
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1735
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1736
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1737
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1738
- if (networkCountId >= 0) {
1739
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1740
- }
1741
- }
1742
- });
1743
- //customize sched content
1744
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1745
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1746
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1747
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1748
- if (networkCountId >= 0) {
1749
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').hide();
1750
- }
1751
- }
1752
- }
1753
- }
1754
- }
1755
- jQuery('.b2s-upload-image-invalid-extension').hide();
1756
- jQuery('.b2s-upload-image-no-permission').hide();
1757
- jQuery('.b2s-upload-image-free-version-info').hide();
1758
- jQuery('#b2s-network-select-image').modal('hide');
1759
- return false;
1760
- });
1761
- jQuery(document).on('change', '.b2s-post-item-details-relay', function () {
1762
- if (jQuery(this).attr('data-user-version') == 0) {
1763
- jQuery(this).prop("checked", false);
1764
- jQuery('#b2sInfoPostRelayModal').modal('show');
1765
- return false;
1766
- }
1767
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1768
- if (jQuery(this).is(":checked")) {
1769
-
1770
- if (jQuery('#b2sRelayAccountData').val() != "") {
1771
- jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1772
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1773
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1774
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1775
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1776
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1777
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
1778
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
1779
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1780
- //Relay Html Data
1781
- if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').has('option').length == 0) {
1782
- var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
1783
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').append(optionData);
1784
- }
1785
-
1786
- } else {
1787
- jQuery(this).prop("checked", false);
1788
- }
1789
-
1790
- } else {
1791
- jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1792
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1793
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1794
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1795
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1796
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
1797
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
1798
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1799
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1800
- }
1801
- return false;
1802
- });
1803
- jQuery(document).on('click', '.b2s-post-item-details-relay-input-add', function () {
1804
- var netCount = jQuery(this).attr('data-network-count');
1805
- var netCountNext = parseInt(netCount) + 1;
1806
- jQuery(this).hide();
1807
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1808
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1809
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1810
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1811
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1812
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1813
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1814
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1815
- jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1816
- //Relay Html Data
1817
- if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').has('option').length == 0) {
1818
- var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
1819
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').append(optionData);
1820
- }
1821
-
1822
- return false;
1823
- });
1824
- jQuery(document).on('click', '.b2s-post-item-details-relay-input-hide', function () {
1825
- var netCount = jQuery(this).attr('data-network-count');
1826
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
1827
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
1828
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
1829
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
1830
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
1831
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
1832
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
1833
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide()
1834
- jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
1835
- if (netCount >= 1) {
1836
- var before = netCount - 1;
1837
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + before + '"]').show();
1838
- }
1839
-
1840
- return false;
1841
- });
1842
- jQuery(document).on('click', '.b2s-image-change-all-network', function () {
1843
- jQuery('.b2s-post-item-details-item-message-input-allow-html').each(function () {
1844
- var sce = jQuery(this).sceditor('instance');
1845
- if (typeof sce !== 'undefined' && typeof sce.insert !== 'undefined') {
1846
- if (sce.getBody().find(".b2s-post-item-details-image-html-src").length > 0) {
1847
- sce.getBody().find(".b2s-post-item-details-image-html-src").attr('src', jQuery('input[name=image_url]:checked').val());
1848
- } else {
1849
- sce.insert("<br /><img class='b2s-post-item-details-image-html-src' src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
1850
- }
1851
- }
1852
- });
1853
- jQuery('.b2s-post-item-details-url-image[data-network-image-change="1"]').attr('src', jQuery('input[name=image_url]:checked').val());
1854
- jQuery('#b2s_blog_default_image').val(jQuery('input[name=image_url]:checked').val());
1855
- jQuery('.b2s-post-item-details-url-image').removeClass('b2s-img-required');
1856
- jQuery('.b2s-image-url-hidden-field').val(jQuery('input[name=image_url]:checked').val());
1857
- jQuery('.b2s-image-remove-btn').show();
1858
- var networkCountId = jQuery(this).attr('data-network-count');
1859
- if (networkCountId >= 0) {
1860
- jQuery('.b2s-image-remove-btn[data-network-count="-1"]').hide();
1861
- }
1862
-
1863
- jQuery('.b2s-upload-image-invalid-extension').hide();
1864
- jQuery('.b2s-upload-image-no-permission').hide();
1865
- jQuery('.b2s-upload-image-free-version-info').hide();
1866
- jQuery('.b2sChangeOgMeta').val("1");
1867
- jQuery('.b2sChangeCardMeta').val("1");
1868
- jQuery('#b2s-network-select-image').modal('hide');
1869
- return false;
1870
- });
1871
- jQuery(document).on('click', '.b2s-upload-image', function () {
1872
- if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
1873
- jQuery('#b2s-network-select-image').modal('hide');
1874
- wpMedia = wp.media({
1875
- title: jQuery('#b2s_wp_media_headline').val(),
1876
- button: {
1877
- text: jQuery('#b2s_wp_media_btn').val(),
1878
- },
1879
- multiple: false,
1880
- library: {type: 'image'}
1881
- });
1882
- wpMedia.open();
1883
- wpMedia.on('select', function () {
1884
- var validExtensions = ['jpg', 'jpeg', 'png'];
1885
- var attachment = wpMedia.state().get('selection').first().toJSON();
1886
- var attachmenUrl = attachment.url;
1887
- var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
1888
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
1889
- if (jQuery.inArray(attachmenUrlExt, validExtensions) == -1) {
1890
- jQuery('#b2s-network-select-image').modal('show');
1891
- jQuery('.b2s-upload-image-invalid-extension').show();
1892
- jQuery('#b2s-upload-image-invalid-extension-file-name').html('<span class="glyphicon glyphicon-ban-circle"></span> ' + attachment.name + '.' + attachmenUrlExt + '<br>');
1893
- jQuery('.b2s-choose-image-no-image-info-text').hide();
1894
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
1895
- return false;
1896
- }
1897
- var count = parseInt(jQuery('.b2s-choose-image-count').val());
1898
- count = count + 1;
1899
- jQuery('.b2s-choose-image-count').val(count);
1900
- var content = '<div class="b2s-image-item">' +
1901
- '<div class="b2s-image-item-thumb">' +
1902
- '<label for="b2s-image-count-' + count + '">' +
1903
- '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
1904
- '</label>' +
1905
- '</div>' +
1906
- '<div class="b2s-image-item-caption text-center">' +
1907
- '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
1908
- '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
1909
- '</div>' +
1910
- '</div>';
1911
- jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
1912
- jQuery('.b2s-image-change-btn-area').show();
1913
- jQuery('.b2s-choose-image-no-image-info-text').hide();
1914
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
1915
- jQuery('.b2s-upload-image-invalid-extension').hide();
1916
- jQuery('input[name=image_url]:last').prop("checked", true);
1917
- jQuery('#b2s-network-select-image').modal('show');
1918
- imageSize();
1919
- });
1920
- wpMedia.on('close', function () {
1921
- jQuery('#b2s-network-select-image').modal('show');
1922
- });
1923
- } else {
1924
- jQuery('.b2s-upload-image-no-permission').show();
1925
- }
1926
- return false;
1927
- });
1928
- jQuery(document).on('click', '.b2s-upload-image-free-version', function () {
1929
- jQuery('.b2s-upload-image-free-version-info').show();
1930
- });
1931
- jQuery("#b2sNetworkSent").keypress(function (e) {
1932
- if (e.keyCode == 13 && e.target.tagName == "INPUT")
1933
- return false;
1934
- });
1935
- jQuery.validator.addMethod("checkUrl", function (value, element, regexp) {
1936
- var re = new RegExp(regexp);
1937
- return this.optional(element) || re.test(value);
1938
- }, "Invalid Url");
1939
- jQuery.validator.addClassRules("b2s-post-item-details-item-url-input", {
1940
- checkUrl: /^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/
1941
- });
1942
- //Twitter TOS 032018 - protected multiple accounts with same content to same time ( by all connections)
1943
- jQuery.validator.addMethod("unique", function (value, element, params) {
1944
- var curNetworkAuthId = jQuery(element).attr('data-network-auth-id');
1945
- var curNetworkId = jQuery(element).attr('data-network-id');
1946
- var prefix = params;
1947
- var selector = jQuery.validator.format("[name!='{0}'][unique='{1}']", element.name, prefix);
1948
- var matches = new Array();
1949
-
1950
- jQuery('.b2s-unique-content[data-network-id="' + curNetworkId + '"]').hide();
1951
- jQuery('.tw-textarea-input').removeClass('error');
1952
-
1953
- jQuery(selector).each(function (index, item) {
1954
- //none disabled elements || ignore default content if curSchedMode=1
1955
- if (!jQuery(item).is(':not(:disabled)') || !jQuery(item).is(':visible') || !jQuery('.b2s-post-item[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').is(':visible') || (jQuery(item).attr('data-network-count') == -1 && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"] option[value="1"]:selected').length > 0)) {
1956
- return true;
1957
- }
1958
- if (jQuery.trim(value) == jQuery.trim(jQuery(item).val())) {
1959
- jQuery('.b2s-unique-content[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').show();
1960
- jQuery('.tw-textarea-input[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').addClass('error');
1961
- matches.push(item);
1962
- }
1963
- });
1964
- if (matches.length != 0) {
1965
- jQuery('.b2s-unique-content[data-network-auth-id="' + curNetworkAuthId + '"]').show();
1966
- }
1967
- return matches.length == 0;
1968
- });
1969
-
1970
-
1971
- jQuery.validator.classRuleSettings.unique = {
1972
- unique: true
1973
- };
1974
- jQuery.validator.addMethod("checkTags", function (value, element, test) {
1975
- var allowed_tags = ['p', 'h1', 'h2', 'br', 'i', 'b', 'a', 'img'];
1976
- var tags = value.match(/(<([^>]+)>)/ig);
1977
- if (tags !== null && tags.length > 0) {
1978
- if (jQuery(element).hasClass('b2s-post-item-details-item-message-input-allow-html')) {
1979
- for (var i = 0; i < tags.length; i++) {
1980
- var allowed_count = 0;
1981
- for (var e = 0; e < allowed_tags.length; e++) {
1982
- var regex = new RegExp("<\s*(\/)?" + allowed_tags[e] + "(( [^>]*>)|[>])");
1983
- if (tags[i].match(regex) != null) {
1984
- allowed_count = 1;
1985
- }
1986
- }
1987
- if (allowed_count == 0) {
1988
- return false;
1989
- }
1990
- }
1991
- } else {
1992
- return false;
1993
- }
1994
- }
1995
- return true;
1996
- });
1997
- jQuery.validator.addClassRules('b2s-post-item-details-item-message-input', {'checkTags': true});
1998
- jQuery.validator.addClassRules('b2s-post-item-details-release-input-date-select', {'checkSched': true});
1999
- jQuery.validator.addClassRules('b2s-post-item-details-item-title-input', {required: true});
2000
- jQuery.validator.addMethod('checkSched', function (value, element, rest) {
2001
- if (jQuery(element).is(':not(:disabled)') && jQuery(element).val() != 0) {
2002
- var networkAuthId = jQuery(element).attr('data-network-auth-id');
2003
- if (jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2004
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2005
- return false;
2006
- } else {
2007
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2008
- }
2009
- if (jQuery(element).val() == 1) {
2010
- if (jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2011
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2012
- return false;
2013
- } else {
2014
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2015
- }
2016
-
2017
- } else {
2018
- var maxCount = jQuery('.b2s-post-item-details-release-input-daySelect[data-network-auth-id="' + networkAuthId + '"]').length;
2019
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2020
- var daySelect = false;
2021
- var daySelectErrorCount = 0;
2022
- for (var count = 0; count < maxCount; count++) {
2023
- if (jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').is(':not(:disabled)')) {
2024
- daySelect = false;
2025
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').each(function () {
2026
- if (jQuery(this).is(':checked')) {
2027
- daySelect = true;
2028
- }
2029
- });
2030
- if (daySelect === false) {
2031
- daySelectErrorCount += 1;
2032
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').addClass('error');
2033
- }
2034
- }
2035
- }
2036
- if (daySelectErrorCount != 0) {
2037
- return false;
2038
- }
2039
- }
2040
- }
2041
- return true;
2042
- });
2043
- jQuery("#b2sNetworkSent").validate({
2044
- ignore: "",
2045
- errorPlacement: function () {
2046
- return false;
2047
- },
2048
- submitHandler: function (form) {
2049
- if (checkNetworkSelected() == false) {
2050
- return false;
2051
- }
2052
- if (checkPostSchedOnBlog() == false) {
2053
- return false;
2054
- }
2055
- if (checkImageByImageNetworks() == false) {
2056
- return false;
2057
- }
2058
-
2059
- var userDate = new Date();
2060
- var pubDate = userDate.getFullYear() + "-" + padDate(userDate.getMonth() + 1) + "-" + padDate(userDate.getDate()) + " " + padDate(userDate.getHours()) + ":" + padDate(userDate.getMinutes()) + ":" + padDate(userDate.getSeconds());
2061
- jQuery('#publish_date').val(pubDate);
2062
- jQuery(".b2s-loading-area").show();
2063
- jQuery(".b2s-post-area").hide();
2064
- jQuery(".b2s-settings-user-sched-time-area").hide();
2065
- jQuery('#b2s-sidebar-wrapper').hide();
2066
- jQuery('.b2s-post-item-info-area').hide();
2067
- jQuery.xhrPool.abortAll();
2068
- jQuery('.b2s-server-connection-fail').hide();
2069
- jQuery.ajax({
2070
- processData: false,
2071
- url: ajaxurl,
2072
- type: "POST",
2073
- dataType: "json",
2074
- cache: false,
2075
- data: jQuery(form).serialize(),
2076
- error: function () {
2077
- jQuery('.b2s-server-connection-fail').show();
2078
- return false;
2079
- },
2080
- success: function (data) {
2081
- var content = data.content;
2082
- jQuery(".b2s-loading-area").hide();
2083
- for (var i = 0; i < content.length; i++) {
2084
- jQuery('.b2s-post-item-details-message-info[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2085
- jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2086
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
2087
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
2088
- jQuery('.b2s-post-approve-info').hide();
2089
- jQuery('.b2s-content-info').hide();
2090
- if (typeof content[i]['approve'] !== typeof undefined) {
2091
- jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
2092
- }
2093
- }
2094
- jQuery(".b2s-post-area").show();
2095
- jQuery('.b2s-publish-area').hide();
2096
- jQuery('.b2s-footer-menu').hide();
2097
- window.scrollTo(0, 0);
2098
- jQuery('.b2s-empty-area').hide();
2099
- jQuery('.b2s-reporting-btn-area').show();
2100
- wp.heartbeat.connectNow();
2101
- }
2102
- });
2103
- return false;
2104
- }
2105
- });
2106
- jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
2107
- jQuery('.b2s-network-list-modal-mandant').html(jQuery(".b2s-network-details-mandant-select option:selected").text());
2108
- });
2109
- jQuery(window).on("load", function () {
2110
- var showMeridian = true;
2111
- if (jQuery('#b2sUserLang').val() == 'de') {
2112
- showMeridian = false;
2113
- }
2114
- jQuery('.b2s-settings-sched-item-input-time').timepicker({
2115
- minuteStep: 30,
2116
- appendWidgetTo: 'body',
2117
- showSeconds: false,
2118
- showMeridian: showMeridian,
2119
- defaultTime: 'current'
2120
- });
2121
- });
2122
-
2123
- jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
2124
- var selectedAuth = new Array();
2125
- jQuery('.b2s-network-list.active').each(function () {
2126
- selectedAuth.push(jQuery(this).parents('.b2s-network-select-btn').attr('data-network-auth-id'));
2127
- });
2128
- jQuery('.b2s-server-connection-fail').hide();
2129
- jQuery.ajax({
2130
- url: ajaxurl,
2131
- type: "POST",
2132
- dataType: "json",
2133
- cache: false,
2134
- data: {
2135
- 'action': 'b2s_ship_navbar_save_settings',
2136
- 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
2137
- 'selectedAuth': selectedAuth
2138
- },
2139
- error: function () {
2140
- jQuery('.b2s-server-connection-fail').show();
2141
- return false;
2142
- },
2143
- success: function (data) {
2144
- if (data.result == true) {
2145
- jQuery('.b2s-ship-settings-save').show();
2146
- window.scrollTo(0, 0);
2147
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2148
- jQuery('.b2s-network-list').each(function () {
2149
- var jsonMandantIds = jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2150
- if (jsonMandantIds !== undefined) {
2151
- var jsonMandantIds = jQuery.parseJSON(jsonMandantIds);
2152
- if (jsonMandantIds.indexOf(mandantId) !== -1 && !jQuery(this).hasClass('active')) {
2153
- //remove
2154
- var newMandant = new Array();
2155
- jQuery(jsonMandantIds).each(function (index, item) {
2156
- if (item !== mandantId) {
2157
- newMandant.push(item);
2158
- }
2159
- });
2160
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(newMandant));
2161
- } else if (jsonMandantIds.indexOf(mandantId) == -1 && jQuery(this).hasClass('active')) {
2162
- //add
2163
- jsonMandantIds.push(mandantId);
2164
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(jsonMandantIds));
2165
- }
2166
- }
2167
- });
2168
- }
2169
- }
2170
- });
2171
- });
2172
- window.addEventListener('message', function (e) {
2173
- if (e.origin == jQuery('#b2sServerUrl').val()) {
2174
- var data = JSON.parse(e.data);
2175
- if (typeof data.action !== typeof undefined && data.action == 'approve') {
2176
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + data.networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2177
- jQuery.ajax({
2178
- url: ajaxurl,
2179
- type: "POST",
2180
- cache: false,
2181
- async: false,
2182
- data: {
2183
- 'action': 'b2s_update_approve_post',
2184
- 'post_id': data.post_id,
2185
- 'publish_link': data.publish_link,
2186
- 'publish_error_code': data.publish_error_code,
2187
- },
2188
- success: function (data) {
2189
- }
2190
- });
2191
- } else {
2192
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
2193
- }
2194
- }
2195
- });
2196
-
2197
- jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
2198
- var postId = jQuery('#b2s-approve-post-id').val();
2199
- var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
2200
- if (postId > 0) {
2201
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2202
- jQuery('.b2s-publish-approve-modal').modal('hide');
2203
- jQuery.ajax({
2204
- url: ajaxurl,
2205
- type: "POST",
2206
- cache: false,
2207
- async: false,
2208
- data: {
2209
- 'action': 'b2s_update_approve_post',
2210
- 'post_id': postId,
2211
- 'publish_link': "",
2212
- 'publish_error_code': "",
2213
- },
2214
- success: function (data) {
2215
- }
2216
- });
2217
- }
2218
- });
2219
-
2220
-
2221
-
2222
- jQuery.xhrPool.abortAll = function () { // our abort function
2223
- jQuery(this).each(function (idx, jqXHR) {
2224
- jqXHR.abort();
2225
- });
2226
- jQuery.xhrPool.length = 0
2227
- };
2228
- function loadingDummyShow(networkAuthId, networkId) {
2229
- jQuery('.b2s-post-item-connection-fail-dummy[data-network-auth-id="' + networkAuthId + '"]').remove();
2230
- var html = '<div class="b2s-post-item b2s-post-item-loading-dummy" data-network-auth-id="' + networkAuthId + '">'
2231
- + '<div class="panel panel-group">'
2232
- + '<div class="panel-body">'
2233
- + '<div class="b2s-post-item-area">'
2234
- + '<div class="b2s-post-item-details">'
2235
- + '<div class="b2s-loader-impulse b2s-loader-impulse-md b2s-post-item-loading-impulse-area">'
2236
- + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2237
- + '</div>'
2238
- + '<div class="clearfix"></div>'
2239
- + '<div class="text-center"><small>'
2240
- + jQuery('#b2sJsTextLoading').val()
2241
- + '</small></div>'
2242
- + '</div>'
2243
- + '</div>'
2244
- + '</div>'
2245
- + '</div>';
2246
- var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
2247
- var pos = order.indexOf(networkAuthId.toString());
2248
- var add = false;
2249
- for (var i = pos; i >= 0; i--) {
2250
- if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
2251
- jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(html);
2252
- i = -1;
2253
- add = true;
2254
- }
2255
- }
2256
- if (add == false) {
2257
- jQuery('.b2s-post-list').prepend(html);
2258
- }
2259
- }
2260
-
2261
- function loadingDummyConnectionFail(networkAuthId, networkId) {
2262
- var html = '<div class="b2s-post-item b2s-post-item-connection-fail-dummy" data-network-auth-id="' + networkAuthId + '">'
2263
- + '<div class="panel panel-group">'
2264
- + '<div class="panel-body">'
2265
- + '<div class="b2s-post-item-area">'
2266
- + '<div class="b2s-post-item-details">'
2267
- + '<div class="b2s-post-item-details-portal-img-area">'
2268
- + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2269
- + '</div>'
2270
- + '<div class="clearfix"></div>'
2271
- + '<div class="text-center"><small>'
2272
- + jQuery('#b2sJsTextConnectionFail').val()
2273
- + '</small>'
2274
- + '<br/>'
2275
- + '<a class="btn btn-link btn-sm" target="_blank" href="' + jQuery('#b2sJsTextConnectionFailLink').val() + '">' + jQuery('#b2sJsTextConnectionFailLinkText').val() + '</a>'
2276
- + '</div>'
2277
- + '</div>'
2278
- + '</div>'
2279
- + '</div>'
2280
- + '</div>';
2281
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + networkAuthId + '"]').replaceWith(html);
2282
- }
2283
-
2284
- function init(firstrun) {
2285
- var dateFormat = "yyyy-mm-dd";
2286
- var language = "en";
2287
- var showMeridian = true;
2288
- if (jQuery('#b2sUserLang').val() == "de") {
2289
- dateFormat = "dd.mm.yyyy";
2290
- language = "de";
2291
- showMeridian = false;
2292
- }
2293
- var today = new Date();
2294
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
2295
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
2296
- }
2297
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
2298
- format: dateFormat,
2299
- language: language,
2300
- maxViewMode: 2,
2301
- todayHighlight: true,
2302
- startDate: today,
2303
- calendarWeeks: true,
2304
- autoclose: true
2305
- });
2306
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
2307
- minuteStep: 15,
2308
- appendWidgetTo: 'body',
2309
- showSeconds: false,
2310
- showMeridian: showMeridian,
2311
- defaultTime: 'current',
2312
- snapToStep: true
2313
- });
2314
- checkNetworkSelected();
2315
- //imageCheck();
2316
- if (firstrun == true) {
2317
- jQuery(window).scroll(function () {
2318
- submitArea();
2319
- });
2320
- jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
2321
- releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), 0);
2322
- });
2323
-
2324
- //V5.0.0 Content Curation set selected Profile
2325
- if (jQuery(".b2s-network-details-mandant-select option[value='" + jQuery('#selProfile').val() + "']").length > 0) {
2326
- jQuery('.b2s-network-details-mandant-select').val(jQuery('#selProfile').val());
2327
- }
2328
- hideDuplicateAuths();
2329
- chooseMandant();
2330
- }
2331
- }
2332
-
2333
-
2334
-
2335
- function initSceditor(networkAuthId) {
2336
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2337
- if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2338
- sceditor.destroy();
2339
- }
2340
-
2341
- jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor({
2342
- plugins: 'xhtml',
2343
- toolbar: "h1,h2,bold,italic,link,unlink,custom-image|source",
2344
- autoUpdate: true,
2345
- emoticonsEnabled: false
2346
- });
2347
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2348
- if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2349
- sceditor.keyUp(function () {
2350
- jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(jQuery(this).prev('.b2s-post-item-details-item-message-input').sceditor('instance').getBody().text().length);
2351
- });
2352
- jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').next('.sceditor-container').find('textarea').on('keyup', function () {
2353
- var tmp = document.createElement("DIV");
2354
- tmp.innerHTML = jQuery(this).val();
2355
- jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(tmp.innerText.length);
2356
- });
2357
- }
2358
-
2359
-
2360
- }
2361
-
2362
- function submitArea() {
2363
- if (jQuery('.b2s-publish-area').length > 0) {
2364
- if (jQuery(window).scrollTop() + jQuery(window.top).height() >= jQuery('.b2s-publish-area').offset().top) {
2365
- jQuery(".b2s-footer-menu").hide();
2366
- } else {
2367
- jQuery(".b2s-footer-menu").show();
2368
- }
2369
- }
2370
- }
2371
-
2372
- function imageSize() {
2373
- jQuery('.networkImage').each(function () {
2374
- var width = this.naturalWidth;
2375
- var height = this.naturalHeight;
2376
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
2377
- if (width == 0)
2378
- {
2379
- setTimeout(function () {
2380
- imageSize();
2381
- }, 50);
2382
- }
2383
- });
2384
- }
2385
-
2386
- function navbarDeactivatePortal(reason) {
2387
- if (reason == "image") {
2388
- var portale = Array(6, 7, 12);
2389
- for (var i = 0; i <= portale.length; i++) {
2390
- jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').addClass('b2s-network-select-btn-deactivate');
2391
- jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').show();
2392
- }
2393
- }
2394
- }
2395
-
2396
- function navbarActivatePortal(reason) {
2397
- if (reason == "image") {
2398
- var portale = Array(6, 7, 12);
2399
- for (var i = 0; i <= portale.length; i++) {
2400
- jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').removeClass('b2s-network-select-btn-deactivate');
2401
- jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').hide();
2402
- }
2403
- }
2404
- }
2405
-
2406
- function deactivatePortal(networkAuthId) {
2407
- var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2408
- jQuery(selector).hide();
2409
- jQuery(selector).find('.form-control').each(function () {
2410
- jQuery(this).attr("disabled", "disabled");
2411
- });
2412
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2413
- checkNetworkSelected();
2414
- submitArea();
2415
- return true;
2416
- }
2417
-
2418
- function activatePortal(networkAuthId, check) {
2419
- var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2420
- jQuery(selector).show();
2421
- jQuery(selector).find('.form-control').each(function () {
2422
-
2423
- if (!jQuery(this).hasClass('b2s-post-item-details-item-message-input')) {
2424
- jQuery(this).removeAttr("disabled", "disabled");
2425
- }
2426
-
2427
- if ((jQuery(this).hasClass('b2s-post-item-details-release-input-weeks')) ||
2428
- (jQuery(this).hasClass('b2s-post-item-details-release-input-date')) ||
2429
- (jQuery(this).hasClass('b2s-post-item-details-release-input-time')) ||
2430
- (jQuery(this).hasClass('b2s-post-item-details-release-input-days')) ||
2431
- (jQuery(this).hasClass('b2s-post-item-details-relay-input-delay')) ||
2432
- (jQuery(this).hasClass('b2s-post-item-details-relay-input-account'))) {
2433
- if (!jQuery(this).is(':visible')) {
2434
- jQuery(this).prop('disabled', true);
2435
- }
2436
- }
2437
- });
2438
- //Customize Content
2439
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
2440
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
2441
- jQuery(selector).find('.b2s-post-item-details-item-message-input').each(function () {
2442
- if (jQuery(this).is(':visible')) {
2443
- jQuery(this).removeAttr("disabled", "disabled");
2444
- }
2445
- });
2446
- } else {
2447
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').removeAttr("disabled", "disabled");
2448
- }
2449
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().addClass('active').find('.b2s-network-hide').removeClass('b2s-network-hide');
2450
- checkNetworkSelected();
2451
- submitArea();
2452
- }
2453
-
2454
- function checkNetworkSelected() {
2455
- //überprüfen ob mindestens ein PostItem vorhanden und sichtbar ist
2456
- var visible = false;
2457
- jQuery('.b2s-post-list').find('.b2s-post-item').each(function () {
2458
- if (jQuery(this).is(":visible")) {
2459
- visible = true;
2460
- }
2461
- });
2462
- if (jQuery('.b2s-post-list').text().trim() == "" || visible == false) {
2463
- jQuery('.b2s-publish-area').hide();
2464
- jQuery('.b2s-footer-menu').hide();
2465
- jQuery('.b2s-empty-area').show();
2466
- return false;
2467
- } else {
2468
- jQuery('.b2s-publish-area').show();
2469
- if (jQuery('.b2s-publish-area').length > 0) {
2470
- if (jQuery(window).scrollTop() + jQuery(window.top).height() < jQuery('.b2s-publish-area').offset().top) {
2471
- jQuery('.b2s-footer-menu').show();
2472
- }
2473
- }
2474
- jQuery('.b2s-empty-area').hide();
2475
- return true;
2476
- }
2477
- }
2478
-
2479
- function checkPostSchedOnBlog() {
2480
- if (jQuery('#b2sBlogPostSchedDate').length > 0 && jQuery('#b2sPostType').val() == "") {
2481
- if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
2482
- if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
2483
- jQuery('#b2s-network-sched-post-info').modal("show");
2484
- return false;
2485
- }
2486
- }
2487
- }
2488
- return true;
2489
- }
2490
-
2491
- function checkImageByImageNetworks() {
2492
- var result = true;
2493
- jQuery('.b2sOnlyWithImage').each(function () {
2494
- if (jQuery(this).is(":visible")) {
2495
- if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "") {
2496
- if (!jQuery('#b2s-network-select-image').hasClass('in')) {
2497
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-img-required');
2498
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
2499
- jQuery('.b2s-upload-image').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
2500
- jQuery('#b2s-network-select-image').modal('show');
2501
- imageSize();
2502
- window.scrollTo(0, (jQuery(this).offset().top - 45));
2503
- }
2504
- result = false;
2505
- }
2506
- }
2507
- });
2508
- return result;
2509
- }
2510
-
2511
-
2512
- function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
2513
- var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
2514
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2515
- if (choose == 0) {
2516
-
2517
- //since 4.8.0 customize content
2518
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2519
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2520
-
2521
- //Facebook TOS
2522
- if (jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').attr('readonly')) {
2523
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').hide();
2524
- } else {
2525
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').show();
2526
- }
2527
-
2528
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2529
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2530
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2531
- jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2532
- jQuery('.b2s-post-tool-area' + selectorInput).show();
2533
- }
2534
-
2535
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2536
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2537
- jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2538
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2539
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2540
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2541
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2542
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
2543
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2544
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2545
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2546
- //monthly- duration month
2547
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2548
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2549
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2550
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2551
- //monthly- publish day (select-day)
2552
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2553
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2554
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2555
- //own period- duration times
2556
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2557
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2558
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2559
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2560
- //own period- timespan
2561
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2562
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2563
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2564
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled');
2565
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2566
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).hide();
2567
- jQuery('.2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2568
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', true);
2569
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2570
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2571
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2572
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2573
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).hide();
2574
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).hide();
2575
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2576
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2577
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2578
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2579
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).hide();
2580
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2581
- } else if (choose == 1) {
2582
-
2583
- //since 4.8.0 customize content
2584
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2585
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').prop('disabled', true);
2586
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').hide();
2587
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').hide();
2588
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').hide();
2589
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').hide();
2590
- jQuery('.b2s-post-original-area' + selectorInput).removeClass('col-sm-7').removeClass('col-lg-9');
2591
- jQuery('.b2s-post-tool-area' + selectorInput).hide();
2592
- //TOS Network Twitter
2593
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-id') == "2") {
2594
- jQuery('.b2s-post-ship-item-copy-original-text' + selectorInput + '[data-network-count="0"]').trigger('click');
2595
- }
2596
- }
2597
-
2598
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2599
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2600
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2601
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2602
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2603
- for (var i = 0; i <= dataNetworkCount; i++) {
2604
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2605
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2606
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2607
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2608
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2609
- //since 4.8.0 customize content
2610
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2611
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2612
- }
2613
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2614
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled');
2615
- //monthly- duration month
2616
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2617
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2618
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2619
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2620
- //monthly- publish day (select-day)
2621
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2622
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2623
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2624
- //own period- duration times
2625
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2626
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2627
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2628
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2629
- //own period- timespan
2630
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2631
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2632
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2633
- //new since v.4.5.0
2634
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2635
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2636
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2637
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2638
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2639
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
2640
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2641
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2642
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2643
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).show();
2644
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2645
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2646
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2647
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2648
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2649
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2650
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).show();
2651
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2652
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2653
- } else if (choose == 2) {
2654
-
2655
- //since 4.8.0 customize content
2656
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2657
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2658
-
2659
- //Facebook TOS
2660
- if (jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').attr('readonly')) {
2661
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').hide();
2662
- } else {
2663
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').show();
2664
- }
2665
-
2666
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2667
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2668
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2669
- jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2670
- jQuery('.b2s-post-tool-area' + selectorInput).show();
2671
- }
2672
-
2673
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2674
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2675
- jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2676
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2677
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2678
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2679
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2680
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2681
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).show();
2682
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2683
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2684
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2685
- for (var i = 0; i <= dataNetworkCount; i++) {
2686
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2687
- //new since v4.5.0
2688
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).show();
2689
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2690
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2691
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2692
- jQuery('.b2s-post-item-details-release-input-daySelect[data-network-count="' + i + '"]' + selectorInput).show();
2693
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2694
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2695
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).show();
2696
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2697
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2698
- }
2699
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).show();
2700
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).show();
2701
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2702
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2703
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).show();
2704
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).show();
2705
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).show();
2706
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2707
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2708
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).show();
2709
- }
2710
-
2711
- var showMeridian = true;
2712
- if (jQuery('#b2sUserLang').val() == 'de') {
2713
- showMeridian = false;
2714
- }
2715
-
2716
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
2717
- minuteStep: 15,
2718
- appendWidgetTo: 'body',
2719
- showSeconds: false,
2720
- showMeridian: showMeridian,
2721
- defaultTime: 'current',
2722
- snapToStep: true
2723
- });
2724
- }
2725
-
2726
-
2727
- function releaseChooseInterval(interval, selectorInput, dataCount) {
2728
- //change view
2729
- if (interval == 0) { //weekly,default
2730
- // show
2731
- //select days
2732
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2733
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
2734
- //duration weeks
2735
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2736
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2737
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).show();
2738
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2739
- //hide
2740
- //monthly- duration month
2741
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2742
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2743
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2744
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2745
- //monthly- publish day (select-day)
2746
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2747
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2748
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2749
- //own period- duration times
2750
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2751
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2752
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2753
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2754
- //own period- timespan
2755
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2756
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2757
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2758
- }
2759
-
2760
- if (interval == 1) { //monthly
2761
- // show
2762
- //duration month
2763
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
2764
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
2765
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).show();
2766
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2767
- //publish day (select-day)
2768
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
2769
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2770
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
2771
- //hide
2772
- //weekly - select days
2773
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
2774
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2775
- //weekly- duration weeks
2776
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2777
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2778
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2779
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2780
- //own period- duration times
2781
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2782
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2783
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2784
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2785
- //own period- timespan
2786
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2787
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2788
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2789
- }
2790
-
2791
- if (interval == 2) { //own period
2792
- // show
2793
- //duration times
2794
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
2795
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
2796
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).show(); //select
2797
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled'); //select
2798
- //timespan
2799
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
2800
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
2801
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2802
- //hide
2803
- //weekly - select days
2804
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
2805
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2806
- //weekly- duration weeks
2807
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2808
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2809
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2810
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2811
- //monthly- duration month
2812
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2813
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2814
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2815
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2816
- //monthly- publish day (select-day)
2817
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2818
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2819
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2820
- }
2821
- }
2822
-
2823
-
2824
-
2825
- function addTag(networkAuthId) {
2826
- var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
2827
- jQuery(selector).last().after('<input class="form-control b2s-post-item-details-tag-input-elem" data-network-auth-id="' + networkAuthId + '" value="" name="b2s[' + networkAuthId + '][tags][]">');
2828
- jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
2829
- }
2830
-
2831
- function removeTag(networkAuthId) {
2832
- var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
2833
- jQuery(selector).last().remove();
2834
- if (jQuery(selector).length === 1)
2835
- jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
2836
- }
2837
-
2838
- function networkLimitAll(networkAuthId, networkId, limit) {
2839
-
2840
- var networkCountId = -1; //default;
2841
- if (jQuery(':focus').length > 0) {
2842
- var attr = jQuery(':focus').attr('data-network-count');
2843
- if (typeof attr !== typeof undefined && attr !== false) {
2844
- networkCountId = attr;
2845
- }
2846
- }
2847
-
2848
- var regX = /(<([^>]+)>)/ig;
2849
- var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
2850
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
2851
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
2852
- if (url.length != "0") {
2853
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
2854
- url = "http://" + url;
2855
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
2856
- }
2857
- } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
2858
- if (!(jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook Imagepost don't require Link
2859
- url = jQuery("#b2sDefault_url").val();
2860
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
2861
- }
2862
- }
2863
-
2864
- var textLength = text.length;
2865
- var newText = text;
2866
- if (networkId == "2") { //twitter
2867
- if (url.length != "0") {
2868
- limit = limit - 24;
2869
- }
2870
- }
2871
- if (networkId == "3") { //linkedin
2872
- if (url.length != "0") {
2873
- limit = limit - url.length;
2874
- }
2875
- }
2876
-
2877
- if (textLength >= limit) {
2878
- newText = text.substring(0, limit);
2879
- var pos = getCaretPos(this);
2880
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val(newText.replace(regX, ""));
2881
- setCaretPos(this, pos);
2882
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
2883
- var textLength = text.length;
2884
- }
2885
- var newLen = limit - textLength;
2886
- jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(newLen);
2887
- }
2888
-
2889
- function networkCount(networkAuthId) {
2890
-
2891
- var networkCountId = -1; //default;
2892
- if (jQuery(':focus').length > 0) {
2893
- var attr = jQuery(':focus').attr('data-network-count');
2894
- if (typeof attr !== typeof undefined && attr !== false) {
2895
- networkCountId = attr;
2896
- }
2897
- }
2898
- var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
2899
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
2900
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
2901
- if (url.length != "0") {
2902
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
2903
- url = "http://" + url;
2904
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
2905
- }
2906
- } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
2907
- if (!(jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook Imagepost don't require Link
2908
- url = jQuery("#b2sDefault_url").val();
2909
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
2910
- }
2911
- }
2912
- var textLength = text.length;
2913
- jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
2914
- }
2915
-
2916
-
2917
- function getCaretPos(domElem) {
2918
- var pos;
2919
- if (document.selection) {
2920
- domElem.focus();
2921
- var sel = document.selection.createRange();
2922
- sel.moveStart("character", -domElem.value.length);
2923
- pos = sel.text.length;
2924
- } else if (domElem.selectionStart || domElem.selectionStart == "0")
2925
- pos = domElem.selectionStart;
2926
- return pos;
2927
- }
2928
-
2929
- function setCaretPos(domElem, pos) {
2930
- if (domElem.setSelectionRange) {
2931
- domElem.focus();
2932
- domElem.setSelectionRange(pos, pos);
2933
- } else if (domElem.createTextRange) {
2934
- var range = domElem.createTextRange();
2935
- range.collapse(true);
2936
- range.moveEnd("character", pos);
2937
- range.moveStart("character", pos);
2938
- range.select();
2939
- }
2940
- }
2941
-
2942
- function ucfirst(str) {
2943
- str += '';
2944
- return str.charAt(0).toUpperCase() + str.substr(1);
2945
- }
2946
-
2947
-
2948
- function hideDuplicateAuths() {
2949
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
2950
- jQuery(this).show();
2951
- });
2952
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2953
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
2954
- if (jQuery(this).is(":visible")) {
2955
- var dataNetworkDisplayName = jQuery(this).children('.b2s-network-select-btn').attr('data-network-display-name');
2956
- var dataNetworkId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-id');
2957
- var dataNetworkType = jQuery(this).children('.b2s-network-select-btn').attr('data-network-type');
2958
- var dataNetworkAuthId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-auth-id');
2959
- jQuery('.b2s-network-select-btn[data-network-display-name="' + dataNetworkDisplayName + '"][data-network-id="' + dataNetworkId + '"][data-network-type="' + dataNetworkType + '"][data-network-auth-id!="' + dataNetworkAuthId + '"]').each(function () {
2960
- var selectedDataMandantId = jQuery.parseJSON(jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id'));
2961
- if (jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-default-id') != mandantId && selectedDataMandantId.indexOf(mandantId) == -1) {
2962
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').hide();
2963
- }
2964
- });
2965
- }
2966
- });
2967
- }
2968
-
2969
- function chooseMandant() {
2970
- //Laden abbrechen und anzeige zurück setzten
2971
- jQuery.xhrPool.abortAll();
2972
- jQuery('.b2s-post-item-loading-dummy').remove();
2973
- jQuery('.b2s-network-status-img-loading').hide();
2974
- jQuery('.b2s-network-select-btn-deactivate').removeClass('b2s-network-select-btn-deactivate');
2975
- //imageCheck();
2976
- //TOS XING Groups
2977
- b2sTosXingGroupCount = 0;
2978
- //expiredDate wieder setzten
2979
- jQuery('.b2s-network-status-expiredDate').each(function () {
2980
- if (jQuery(this).is(':visible')) {
2981
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').addClass('b2s-network-select-btn-deactivate');
2982
- }
2983
- });
2984
- jQuery('.b2s-network-select-btn-deactivate')
2985
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2986
- jQuery('.b2s-post-item').hide();
2987
- jQuery('.b2s-post-item').find('.form-control').each(function () {
2988
- jQuery(this).attr("disabled", "disabled");
2989
- jQuery(this).removeClass('error');
2990
- });
2991
- jQuery('.b2s-network-select-btn').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2992
- //Check IS RE-PUBLISH
2993
- if (jQuery('#b2sSelectedNetworkAuthId').val() > 0 && jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").length > 0) { //exisits?
2994
- jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").trigger('click');
2995
- var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2996
- jQuery('.b2s-network-details-mandant-select').val(mandantId);
2997
- jQuery('#b2sSelectedNetworkAuthId').val("0");
2998
- } else {
2999
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3000
- var mandantIds = jQuery.parseJSON(jQuery(this).attr('data-mandant-id'));
3001
- if (mandantIds.indexOf(mandantId) != -1 && !jQuery(this).children('.b2s-network-select-btn').hasClass('b2s-network-select-btn-deactivate')) {
3002
- jQuery(this).children('.b2s-network-select-btn').trigger('click');
3003
- }
3004
- });
3005
- }
3006
-
3007
- checkNetworkSelected();
3008
- }
3009
-
3010
- function padDate(n) {
3011
- return ("0" + n).slice(-2);
3012
- }
3013
-
3014
- function wop(url, name) {
3015
- jQuery('.b2s-network-auth-success').hide();
3016
- var location = window.location.protocol + '//' + window.location.hostname;
3017
- url = encodeURI(url + '&mandant_id=' + jQuery('.b2s-network-details-mandant-select').val() + '&location=' + location);
3018
- window.open(url, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3019
- }
3020
-
3021
-
3022
- function wopApprove(networkAuthId, postId, url, name) {
3023
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
3024
- var win = window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3025
- if (postId > 0) {
3026
- function checkIfWinClosed(intervalID) {
3027
- if (win.closed) {
3028
- clearInterval(intervalID);
3029
- //Show Modal
3030
- jQuery('.b2s-publish-approve-modal').modal('show');
3031
- jQuery('#b2s-approve-post-id').val(postId);
3032
- jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
3033
- }
3034
- }
3035
- var interval = setInterval(function () {
3036
- checkIfWinClosed(interval);
3037
- }, 500);
3038
- }
3039
- }
3040
-
3041
-
3042
- function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId) {
3043
- jQuery('.b2s-network-auth-success').show();
3044
- jQuery('#b2s-network-list-modal').modal('hide');
3045
- jQuery('#b2s-network-list-modal').hide();
3046
- jQuery('body').removeClass('modal-open');
3047
- jQuery('body').removeAttr('style');
3048
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3049
- jQuery('.b2s-server-connection-fail').hide();
3050
- jQuery.ajax({
3051
- url: ajaxurl,
3052
- type: "POST",
3053
- dataType: "json",
3054
- cache: false,
3055
- data: {
3056
- 'action': 'b2s_ship_navbar_item',
3057
- 'networkId': networkId,
3058
- 'networkType': networkType,
3059
- 'displayName': displayName,
3060
- 'networkAuthId': networkAuthId,
3061
- 'mandandId': mandandId
3062
- },
3063
- error: function () {
3064
- jQuery('.b2s-server-connection-fail').show();
3065
- return false;
3066
- },
3067
- success: function (data) {
3068
- if (data.result == true) {
3069
- jQuery(data.content).insertAfter('.b2s-sidbar-network-auth-btn');
3070
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
3071
- }
3072
- }
3073
- });
3074
- } else {
3075
- jQuery('.b2s-network-status-expiredDate').remove();
3076
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
3077
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
3078
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
3079
- }
3080
- }
3081
-
3082
- //jQuery(this).attr('data-network-auth-id')
3083
- function checkSchedDateTime(dataNetworkAuthId) {
3084
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
3085
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
3086
- var dateStr = jQuery(dateElement).val();
3087
- var minStr = jQuery(timeElement).val();
3088
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
3089
- if (jQuery('#b2sUserLang').val() == 'de') {
3090
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
3091
- } else {
3092
- var minParts = minStr.split(' ');
3093
- var minParts2 = minParts[0].split(':');
3094
- if (minParts[1] == 'PM') {
3095
- minParts2[0] = parseInt(minParts2[0]) + 12;
3096
- }
3097
- minStr = minParts2[0] + ':' + minParts2[1];
3098
- }
3099
-
3100
- var minParts3 = minStr.split(':');
3101
- if (minParts3[0] < 10) {
3102
- minParts3[0] = '0' + minParts3[0];
3103
- }
3104
- var dateParts = dateStr.split('-');
3105
- //utc current time
3106
- var now = new Date();
3107
- //offset between utc und user
3108
- var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
3109
- //enter hour to user time
3110
- var hour = parseInt(minParts3[0]) + timeZone + offset;
3111
- //calculate datetime in utc
3112
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
3113
- //compare enter date time with allowed user time
3114
- if (enter.getTime() < now.getTime()) {
3115
- //enter set on next 15 minutes and calculate on user timezone
3116
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
3117
- jQuery(dateElement).datepicker('update', enter);
3118
- jQuery(timeElement).timepicker('setTime', enter);
3119
- }
3120
-
3121
- //network deprecated
3122
- if (jQuery(dateElement).attr('data-network-id') == '8') {
3123
- var deprecatedDate = new Date('2019-03-30T23:59:59');
3124
- var count = jQuery(dateElement).attr('data-network-count');
3125
- if (enter.getTime() > deprecatedDate.getTime()) {
3126
- jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3127
- jQuery(dateElement).datepicker('update', now);
3128
- jQuery(timeElement).timepicker('setTime', now);
3129
- }
3130
- }
3131
-
3132
- //network deprecated
3133
- if (jQuery(dateElement).attr('data-network-id') == '10') {
3134
- var deprecatedDate = new Date('2019-04-01T23:59:59');
3135
- var count = jQuery(dateElement).attr('data-network-count');
3136
- if (enter.getTime() > deprecatedDate.getTime()) {
3137
- jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3138
- jQuery(dateElement).datepicker('update', now);
3139
- jQuery(timeElement).timepicker('setTime', now);
3140
- }
3141
- }
3142
-
3143
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+ var b2sTosXingGroupCount = 0;
4
+
5
+ jQuery(document).on('heartbeat-send', function (e, data) {
6
+ data['b2s_heartbeat'] = 'b2s_listener';
7
+ });
8
+
9
+ jQuery.xhrPool = [];
10
+
11
+ jQuery(window).on("load", function () {
12
+ init(true);
13
+ imageSize();
14
+ if (jQuery('.toggelbutton').is(':visible') && !jQuery("#b2s-wrapper").hasClass("toggled")) {
15
+ jQuery('.btn-toggle-menu').trigger('click');
16
+ }
17
+ });
18
+
19
+ //Stop duplicate posts by page refreshing during the post process
20
+ jQuery(document).on('keydown', '#b2sNetworkSent', function (event) {
21
+ if (event.keyCode == 116) {
22
+ event.preventDefault();
23
+ return false;
24
+ }
25
+ });
26
+
27
+ jQuery(document).on('click', '.btn-toggle-menu', function () {
28
+ if (jQuery('.toggelbutton').is(':visible')) {
29
+ jQuery("#b2s-wrapper").toggleClass("toggled");
30
+ if (jQuery("#b2s-wrapper").hasClass("toggled")) {
31
+ jQuery(".sidebar-brand").hide();
32
+ jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-right').addClass('glyphicon-chevron-left');
33
+ } else {
34
+ jQuery(".sidebar-brand").show();
35
+ jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-left').addClass('glyphicon-chevron-right');
36
+ }
37
+ }
38
+ });
39
+
40
+ jQuery.sceditor.plugins.xhtml.allowedTags = ['h1', 'h2', 'p', 'br', 'i', 'b', 'a', 'img'];
41
+ jQuery.sceditor.command.set(
42
+ "h1", {
43
+ exec: function () {
44
+ if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H1') {
45
+ this.wysiwygEditorInsertHtml('<h1>', '</h1>');
46
+ } else {
47
+ jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
48
+ }
49
+ },
50
+ txtExec: ["<h1>", "</h1>"],
51
+ tooltip: "H1"
52
+ });
53
+ jQuery.sceditor.command.set(
54
+ "h2", {
55
+ exec: function () {
56
+ if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H2') {
57
+ this.wysiwygEditorInsertHtml('<h2>', '</h2>');
58
+ } else {
59
+ jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
60
+ }
61
+ },
62
+ txtExec: ["<h2>", "</h2>"], tooltip: "H2"});
63
+
64
+ jQuery.sceditor.command.set(
65
+ "custom-image", {
66
+ exec: function () {
67
+ var me = this;
68
+ if (typeof (b2s_is_calendar) != "undefined" && b2s_is_calendar)
69
+ {
70
+ jQuery('.b2s-network-select-image-content').html("");
71
+ jQuery.ajax({
72
+ url: ajaxurl,
73
+ type: "POST",
74
+ cache: false,
75
+ async: false,
76
+ data: {
77
+ 'action': 'b2s_get_image_modal',
78
+ 'id': b2s_current_post_id,
79
+ 'image_url': ''
80
+ },
81
+ success: function (data) {
82
+ jQuery(".b2s-network-select-image-content").html(data);
83
+ }
84
+ });
85
+ }
86
+ var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
87
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
88
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
89
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
90
+ jQuery('.b2s-selected-network-for-image-info').html(content);
91
+ jQuery('#b2s-network-select-image').modal('show');
92
+ jQuery('#b2sInsertImageType').val("1");
93
+ imageSize();
94
+
95
+ },
96
+ txtExec: function () {
97
+ var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
98
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
99
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
100
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
101
+ jQuery('.b2s-selected-network-for-image-info').html(content);
102
+ jQuery('#b2s-network-select-image').modal('show');
103
+ jQuery('#b2sInsertImageType').val("1");
104
+ imageSize();
105
+ }, tooltip: "Image"});
106
+
107
+
108
+ jQuery(document).on('click', '.b2s-toogle-calendar-btn', function () {
109
+
110
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
111
+ var networkId = jQuery(this).attr('data-network-id');
112
+ var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
113
+ var currentBtnText = jQuery(this).text();
114
+
115
+ jQuery(this).text(toogleBtnText);
116
+ jQuery(this).attr('data-toogle-text-btn', currentBtnText);
117
+
118
+ //change to show
119
+ var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
120
+ if (calendar.hasClass('hide')) {
121
+ calendar.removeClass('hide');
122
+ calendar.addClass('show');
123
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').removeClass('hide');
124
+
125
+ if (calendar.is(':empty')) {
126
+ b2s_cur_source_ship_calendar[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + networkId + '&filter_status=2';
127
+
128
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar({
129
+ editable: false,
130
+ locale: b2s_calendar_locale,
131
+ eventLimit: 2,
132
+ contentHeight: 530,
133
+ timeFormat: 'H:mm',
134
+ eventSources: [b2s_cur_source_ship_calendar[0]],
135
+ eventRender: function (event, element) {
136
+ show = true;
137
+ $header = jQuery("<div>").addClass("b2s-calendar-header");
138
+ $isRelayPost = '';
139
+ $isCuratedPost = '';
140
+ if (event.post_type == 'b2s_ex_post') {
141
+ $isCuratedPost = ' (Curated Post)';
142
+ }
143
+ if (event.relay_primary_post_id > 0) {
144
+ $isRelayPost = ' (Retweet)';
145
+ }
146
+ $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
147
+ element.find(".fc-time").after($network_name);
148
+ element.html(element.html());
149
+ $parent = element.parent();
150
+ $header.append(element.find(".fc-content"));
151
+ element.append($header);
152
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
153
+ $body.append(event.avatar);
154
+ $body.append(element.find(".fc-title"));
155
+ $body.append(jQuery("<br>"));
156
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
157
+ $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
158
+ $em.append(event.network_name);
159
+ $em.append(jQuery("<span>").text(": " + event.profile));
160
+ $body.append($em);
161
+ element.append($body);
162
+ },
163
+ dayRender: function (date, element) {
164
+ if (!jQuery(element[0]).hasClass('fc-past')) {
165
+ var date = jQuery(element[0]).attr('data-date');
166
+ var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
167
+ $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddSchedule").val() + "</span>").addClass("b2s-calendar-add-schedule-btn").attr('href', '#').attr('data-network-auth-id', networkAuthId);
168
+ sel_element.append($header);
169
+ }
170
+ }
171
+ });
172
+ } else {
173
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar('refetchEvents');
174
+ }
175
+
176
+ } else {
177
+ calendar.removeClass('show');
178
+ calendar.addClass('hide');
179
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
180
+
181
+ }
182
+
183
+ return false;
184
+
185
+ });
186
+
187
+ jQuery(document).on('click', '.b2s-calendar-add-schedule-btn', function () {
188
+ var selSchedDate = jQuery(this).parent('td').attr('data-date');
189
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
190
+
191
+ if (jQuery('#user_version').val() == 0) {
192
+ jQuery('.b2s-post-item-details-release-input-date-select-reset[data-network-auth-id="' + networkAuthId + '"]').val('0');
193
+ jQuery('#b2s-sched-post-modal').modal('show');
194
+ return false;
195
+ }
196
+
197
+ if (jQuery('#b2sUserLang').val() == 'de') {
198
+ selSchedDate = selSchedDate.substring(8, 10) + '.' + selSchedDate.substring(5, 7) + '.' + selSchedDate.substring(0, 4);
199
+ }
200
+
201
+ //isfirst
202
+ if (!jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"] option[value="1"]:selected').length > 0) {
203
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
204
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
205
+ } else {
206
+ //add
207
+ var curSel = jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"]').filter(':visible');
208
+ if (curSel.length > 0) {
209
+ curSel.trigger('click');
210
+ netCountNext = parseInt(curSel.attr('data-network-count')) + 1;
211
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + netCountNext + '"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
212
+ } else {
213
+ //do not adding write to first
214
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
215
+ }
216
+ }
217
+ return false;
218
+ });
219
+
220
+ jQuery(document).on('change', '.b2s-calendar-filter-network-sel', function () {
221
+ var newSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=2';
222
+ var oldSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).attr('data-last-sel') + '&filter_status=2';
223
+ jQuery(this).attr('data-last-sel', jQuery(this).val());
224
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('removeEventSource', oldSource);
225
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('addEventSource', newSource);
226
+ return false;
227
+ });
228
+
229
+
230
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
231
+ jQuery('.b2s-server-connection-fail').hide();
232
+ jQuery.ajax({
233
+ url: ajaxurl,
234
+ type: "POST",
235
+ dataType: "json",
236
+ cache: false,
237
+ data: {
238
+ 'action': 'b2s_get_settings_sched_time_default',
239
+ },
240
+ error: function () {
241
+ jQuery('.b2s-server-connection-fail').show();
242
+ return false;
243
+ },
244
+ success: function (data) {
245
+ if (data.result == true) {
246
+ var tomorrow = new Date();
247
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
248
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
249
+ }
250
+ tomorrow.setDate(tomorrow.getDate() + 1);
251
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
252
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
253
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
254
+ var today = new Date();
255
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
256
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
257
+ }
258
+
259
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
260
+ var todayDate = ("0" + today.getDate()).slice(-2);
261
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
262
+ var lang = jQuery('#b2sUserLang').val();
263
+ if (lang == "de") {
264
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
265
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
266
+ }
267
+
268
+ jQuery.each(data.times, function (network_id, time) {
269
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
270
+ time.forEach(function (network_type_time, count) {
271
+ if (network_type_time != "") {
272
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
273
+ if (jQuery(this).is(':not(:disabled)')) {
274
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
275
+ //is not set special dates
276
+ 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() == '0') {
277
+ 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");
278
+ }
279
+ 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);
280
+ 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);
281
+ var hours = network_type_time.substring(0, 2);
282
+ if (lang == "en") {
283
+ var timeparts = network_type_time.split(' ');
284
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
285
+ }
286
+ if (hours < today.getHours()) {
287
+ 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);
288
+ 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);
289
+ } else {
290
+ 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);
291
+ 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);
292
+ }
293
+ }
294
+ });
295
+ count++;
296
+ }
297
+ });
298
+ }
299
+ });
300
+ }
301
+ }
302
+ });
303
+ return false;
304
+ });
305
+
306
+
307
+ function formatAMPM(date) {
308
+ var hours = date.getHours();
309
+ var minutes = date.getMinutes();
310
+ var ampm = hours >= 12 ? 'pm' : 'am';
311
+ hours = hours % 12;
312
+ hours = hours ? hours : 12; // the hour '0' should be '12'
313
+ minutes = minutes < 10 ? '0' + minutes : minutes;
314
+ var strTime = hours + ':' + minutes + ' ' + ampm;
315
+ return strTime;
316
+ }
317
+
318
+
319
+
320
+ jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
321
+ jQuery('#b2s-network-list-modal').modal('show');
322
+ return false;
323
+ });
324
+ jQuery(document).on('click', '.change-meta-tag', function () {
325
+ var attr = jQuery(this).attr('readonly');
326
+ if (typeof attr !== typeof undefined && attr !== false) {
327
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
328
+ //Content cuation
329
+ var postType = jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-post-wp-type');
330
+ if (postType != "ex") {
331
+ jQuery('.meta-text').hide();
332
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
333
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
334
+ var isMetaChecked = false;
335
+ if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
336
+ isMetaChecked = true;
337
+ }
338
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
339
+ isMetaChecked = true;
340
+ }
341
+ var showDefault = true;
342
+ if (postFormat == "0" && !isMetaChecked) { //isLinkPost
343
+ showDefault = false;
344
+ if (networkId == "1") {
345
+ jQuery('.isOgMetaChecked').show();
346
+ } else {
347
+ jQuery('.isCardMetaChecked').show();
348
+ }
349
+ }
350
+ if (showDefault) {
351
+ jQuery('.isLinkPost').show();
352
+ }
353
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
354
+ }
355
+ }
356
+ return false;
357
+ });
358
+ // Linkpost change Meta Tags title + desc
359
+ jQuery(document).on('keyup', '.change-meta-tag', function () {
360
+ var currentText = jQuery(this).val();
361
+ var metaTag = jQuery(this).attr('data-meta');
362
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
363
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
364
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
365
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
366
+ if (postFormat == "0") { //if linkpost
367
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
368
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
369
+ //override this content with current content by keyup
370
+ jQuery('.' + metaTag + '[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val(currentText);
371
+ }
372
+ });
373
+ }
374
+ }
375
+ return false;
376
+ });
377
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
378
+ jQuery('.b2s-server-connection-fail').hide();
379
+ jQuery.ajax({
380
+ url: ajaxurl,
381
+ type: "POST",
382
+ dataType: "json",
383
+ cache: false,
384
+ data: {
385
+ 'action': 'b2s_get_settings_sched_time_user',
386
+ },
387
+ error: function () {
388
+ jQuery('.b2s-server-connection-fail').show();
389
+ return false;
390
+ },
391
+ success: function (data) {
392
+ var tomorrow = new Date();
393
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
394
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
395
+ }
396
+
397
+ tomorrow.setDate(tomorrow.getDate() + 1);
398
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
399
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
400
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
401
+ var today = new Date();
402
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
403
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
404
+ }
405
+
406
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
407
+ var todayDate = ("0" + today.getDate()).slice(-2);
408
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
409
+ var lang = jQuery('#b2sUserLang').val();
410
+ if (lang == "de") {
411
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
412
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
413
+ }
414
+ if (data.result == true) {
415
+ //V5.1.0 seeding
416
+ if (data.type == 'new') {
417
+ //new
418
+ jQuery.each(data.times, function (network_auth_id, time) {
419
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
420
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
421
+ //is not set special dates
422
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
423
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
424
+ }
425
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
426
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', time);
427
+ var hours = time.substring(0, 2);
428
+ if (lang == "en") {
429
+ var timeparts = time.split(' ');
430
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
431
+ }
432
+
433
+ var isDelay = false;
434
+ var delayDay = data.delay_day[network_auth_id];
435
+ if (delayDay != undefined) {
436
+ if (delayDay > 0) {
437
+ var delay = new Date();
438
+ delay.setDate(today.getDate() + parseInt(delayDay));
439
+ var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
440
+ var delayDate = ("0" + delay.getDate()).slice(-2);
441
+ var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
442
+ if (lang == 'de') {
443
+ dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
444
+ }
445
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
446
+ isDelay = true;
447
+
448
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
449
+ }
450
+ }
451
+ if (!isDelay) {
452
+ if (hours < today.getHours()) {
453
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
454
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
455
+ } else {
456
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
457
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
458
+ }
459
+ }
460
+ }
461
+ }
462
+ });
463
+ } else {
464
+ //old
465
+ jQuery.each(data.times, function (network_id, time) {
466
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
467
+ time.forEach(function (network_type_time, count) {
468
+ if (network_type_time != "") {
469
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
470
+ if (jQuery(this).is(':not(:disabled)')) {
471
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
472
+ //is not set special dates
473
+ 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') {
474
+ 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");
475
+ }
476
+ 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);
477
+ 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);
478
+ var hours = network_type_time.substring(0, 2);
479
+ if (lang == "en") {
480
+ var timeparts = network_type_time.split(' ');
481
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
482
+ }
483
+ if (hours < today.getHours()) {
484
+ 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);
485
+ 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);
486
+ } else {
487
+ 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);
488
+ 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);
489
+ }
490
+ }
491
+ });
492
+ count++;
493
+ }
494
+ });
495
+ }
496
+ });
497
+ }
498
+ } else {
499
+ //default load best Times
500
+ //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
501
+ //set current time
502
+ jQuery('.b2s-post-item:visible').each(function () {
503
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
504
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
505
+ //is not set special dates
506
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
507
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
508
+ }
509
+ }
510
+ });
511
+ }
512
+ }
513
+ });
514
+ return false;
515
+ });
516
+ jQuery('#b2sPreFeatureModal').on('show.bs.modal', function () {
517
+ jQuery('.b2s-post-item-details-release-input-date-select-reset').val('0');
518
+ });
519
+ jQuery(document).on('click', '.b2s-network-list-add-btn-profeature', function () {
520
+ jQuery('#b2s-network-list-modal').modal('hide');
521
+ });
522
+ jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all', function () {
523
+ var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
524
+ var dataNetworkCount = 0;
525
+ var selMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val();
526
+ if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="1"]').is(":visible")) {
527
+ dataNetworkCount = 1;
528
+ }
529
+ if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="2"]').is(":visible")) {
530
+ dataNetworkCount = 2;
531
+ }
532
+
533
+ jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
534
+ if (jQuery(this).attr('data-network-auth-id') != dataNetworkAuthId && jQuery(this).has('option[value="' + jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val() + '"]').length > 0) {
535
+ jQuery(this).val(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val());
536
+ //view elements
537
+ releaseChoose(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
538
+ //view elements interval
539
+ if (selMode == 2) {
540
+ for (var i = 0; i <= dataNetworkCount; i++) {
541
+ var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
542
+ releaseChooseInterval(curInterval, '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]', i);
543
+ }
544
+ }
545
+ }
546
+ });
547
+ //set values
548
+ for (var i = 0; i <= dataNetworkCount; i++) {
549
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
550
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
551
+ if (selMode == 2) {
552
+ var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
553
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]').val(curInterval);
554
+ if (curInterval == 0) {
555
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
556
+ jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
557
+ jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
558
+ jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
559
+ jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
560
+ jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
561
+ jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
562
+ jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
563
+ }
564
+ if (curInterval == 1) {
565
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
566
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
567
+ }
568
+ if (curInterval == 2) {
569
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
570
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
571
+ }
572
+ }
573
+ }
574
+
575
+ if (dataNetworkCount == 2) {
576
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
577
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
578
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
579
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
580
+ } else if (dataNetworkCount == 1) {
581
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
582
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
583
+ }
584
+
585
+ return false;
586
+ });
587
+ jQuery(document).on("click", ".b2s-user-network-settings-post-format", function () {
588
+ jQuery('.b2s-settings-user-success').hide();
589
+ jQuery('.b2s-settings-user-error').hide();
590
+ jQuery('.b2s-server-connection-fail').hide();
591
+ var networkId = jQuery(this).attr("data-network-id");
592
+ var networkType = jQuery(this).attr("data-network-type");
593
+ var postFormat = jQuery(this).val();
594
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
595
+ var postFormatType = jQuery(this).attr("data-post-format-type");
596
+ var postType = jQuery(this).attr("data-post-wp-type");
597
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
598
+ //PostFormat
599
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
600
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
601
+ if (jQuery('#user_version').val() >= 2) {
602
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][postFormat]);
603
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
604
+ } else {
605
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][postFormat]);
606
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
607
+ }
608
+ }
609
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
610
+ if (textLimit != "0") {
611
+ networkLimitAll(networkAuthId, networkId, textLimit);
612
+ } else {
613
+ networkCount(networkAuthId);
614
+ }
615
+
616
+ //Edit Meta Tags
617
+ var isMetaChecked = false;
618
+ if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
619
+ isMetaChecked = true;
620
+ }
621
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
622
+ isMetaChecked = true;
623
+ }
624
+ if (isMetaChecked && postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
625
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
626
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
627
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
628
+ if (dataMetaType == "og") {
629
+ jQuery('#b2sChangeOgMeta').val("1");
630
+ } else {
631
+ jQuery('#b2sChangeCardMeta').val("1");
632
+ }
633
+
634
+ //Copy from further item meta tags by same network
635
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
636
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
637
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
638
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
639
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
640
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
641
+ if (jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]:visible').length == 1) {
642
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
643
+ } else {
644
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
645
+ }
646
+
647
+ return true;
648
+ }
649
+ });
650
+
651
+ //Set & Check Link
652
+ if (typeof jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]') !== undefined) {
653
+ //Facebook + Twitter && Linkpost
654
+ if (networkId == 1 || networkId == 2 && postFormat == 0) {
655
+ if (jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
656
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefault_url').val());
657
+ }
658
+ }
659
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
660
+ if (!jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
661
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
662
+ } else {
663
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
664
+ }
665
+ }
666
+
667
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
668
+ if (networkId == 1 && networkType == 0) {
669
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
670
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
671
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
672
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
673
+
674
+ }
675
+
676
+ } else {
677
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
678
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
679
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
680
+
681
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
682
+ if (networkId == 1 && networkType == 0) {
683
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
684
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').hide();
685
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').hide();
686
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').show();
687
+ }
688
+ }
689
+
690
+ //Content Curation V5.0.0
691
+ if (postType == "ex") {
692
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
693
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
694
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
695
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
696
+ if (postFormat == '0') {
697
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
698
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
699
+ } else {
700
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
701
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
702
+ }
703
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
704
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
705
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
706
+ }
707
+ }
708
+
709
+ if (networkId == "3") {
710
+ if (postFormat == '0' && jQuery('#user_version').val() > 0) {
711
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
712
+ if (!jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
713
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
714
+ } else {
715
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
716
+ }
717
+ jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').show();
718
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide(); //not showing on linkedin
719
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
720
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
721
+ } else {
722
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
723
+ jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').hide();
724
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
725
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
726
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
727
+ }
728
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
729
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
730
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
731
+ }
732
+ }
733
+
734
+ if (networkId == "19" && networkType == "0") {
735
+ if (postFormat == '0' && jQuery('#user_version').val() > 0) {
736
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
737
+ if (!jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
738
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
739
+ } else {
740
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
741
+ }
742
+ jQuery('.xing-url-title[data-network-auth-id="' + networkAuthId + '"]').show();
743
+ jQuery('.xing-url-desc[data-network-auth-id="' + networkAuthId + '"]').show();
744
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
745
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
746
+ } else {
747
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
748
+ jQuery('.xing-url-title[data-network-auth-id="' + networkAuthId + '"]').hide();
749
+ jQuery('.xing-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
750
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
751
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
752
+ }
753
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
754
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
755
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
756
+ }
757
+ }
758
+
759
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
760
+ jQuery(this).addClass('b2s-settings-checked');
761
+ jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
762
+ return false;
763
+ });
764
+ jQuery(document).on("click", ".b2s-post-ship-item-full-text", function () {
765
+ jQuery('.b2s-server-connection-fail').hide();
766
+ var curSchedCount = jQuery(this).attr('data-network-count');
767
+ jQuery.ajax({
768
+ url: ajaxurl,
769
+ type: "POST",
770
+ dataType: "json",
771
+ cache: false,
772
+ data: {
773
+ 'action': 'b2s_ship_item_full_text',
774
+ 'postId': jQuery('#b2sPostId').val(),
775
+ 'userLang': jQuery('#b2sUserLang').val(),
776
+ 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
777
+ 'networkId': jQuery(this).attr('data-network-id'),
778
+ },
779
+ error: function () {
780
+ jQuery('.b2s-server-connection-fail').show();
781
+ return false;
782
+ },
783
+ success: function (data) {
784
+ if (data.result == true) {
785
+ messageInput = jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + curSchedCount + '"][data-network-auth-id="' + data.networkAuthId + '"]');
786
+ messageInput.val(data.text);
787
+ networkCount(data.networkAuthId);
788
+ networkTextLimit = messageInput.attr('data-network-text-limit');
789
+ if (typeof networkTextLimit != undefined) {
790
+ if (parseInt(networkTextLimit) > 0 && parseInt(data.networkId) > 0) {
791
+ networkLimitAll(data.networkAuthId, data.networkId, networkTextLimit);
792
+ }
793
+ }
794
+ }
795
+ }
796
+ });
797
+ return false;
798
+ });
799
+ jQuery(document).on("click", ".b2s-post-ship-item-message-delete", function () {
800
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
801
+ var networkCountId = jQuery(this).attr('data-network-count');
802
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
803
+ initSceditor(networkAuthId);
804
+ networkCount(networkAuthId);
805
+ return false;
806
+ });
807
+ jQuery(document).on("click", ".b2s-post-ship-item-copy-original-text", function () {
808
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
809
+ var networkCountId = jQuery(this).attr('data-network-count');
810
+ var networkId = jQuery(this).attr('data-network-id');
811
+ var text = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').val();
812
+ if (text == "" && networkId == 2) {
813
+ text = jQuery('#b2sTwitterOrginalPost').val();
814
+ }
815
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(text);
816
+ networkCount(networkAuthId);
817
+ return false;
818
+ });
819
+ jQuery(document).on("click", ".b2s-network-select-btn", function () {
820
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
821
+ var networkId = jQuery(this).attr('data-network-id');
822
+ var networkType = jQuery(this).attr('data-network-type');
823
+
824
+ //doppelklick Schutz
825
+ if (!jQuery(this).hasClass('b2s-network-select-btn-deactivate')) {
826
+ //active?
827
+ if (!jQuery(this).children().hasClass('active')) {
828
+ //TOS XING Groups
829
+ if ((networkId == 8 || networkId == 19) && networkType == 2) {
830
+ if ((b2sTosXingGroupCount == jQuery('#b2sTosXingGroupCrosspostingLimit').val()) || (networkId == 19 && jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-tos-group-id="' + jQuery(this).attr('data-network-tos-group-id') + '"]').children().hasClass('active'))) {
831
+ jQuery('#b2s-tos-xing-group-modal').modal('show');
832
+ return false;
833
+ } else {
834
+ b2sTosXingGroupCount++;
835
+ }
836
+ }
837
+ //schon vorhanden?
838
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').length > 0 && !jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').hasClass('b2s-post-item-connection-fail-dummy')) {
839
+ activatePortal(networkAuthId);
840
+ //PostFormat
841
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
842
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
843
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').attr('data-post-format-type');
844
+ if (jQuery('#user_version').val() >= 2) {
845
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
846
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
847
+ //if linkpost then show btn meta tags
848
+ var isMetaChecked = false;
849
+ if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
850
+ isMetaChecked = true;
851
+ }
852
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
853
+ isMetaChecked = true;
854
+ }
855
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
856
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
857
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
858
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
859
+ if (dataMetaType == "og") {
860
+ jQuery('#b2sChangeOgMeta').val("1");
861
+ } else {
862
+ jQuery('#b2sChangeCardMeta').val("1");
863
+ }
864
+
865
+ //Copy from further item meta tags by same network
866
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
867
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
868
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
869
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
870
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
871
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
872
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
873
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
874
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
875
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
876
+ }
877
+ } else {
878
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
879
+ }
880
+
881
+ return true;
882
+ }
883
+ });
884
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
885
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
886
+ } else {
887
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
888
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
889
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
890
+ }
891
+
892
+ if (networkId == "3") {
893
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
894
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
895
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
896
+ jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').show();
897
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide(); //not showing on linkedin
898
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
899
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
900
+ } else {
901
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
902
+ jQuery('.linkedin-url-title[data-network-auth-id="' + networkAuthId + '"]').hide();
903
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
904
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
905
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
906
+ }
907
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
908
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
909
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
910
+ }
911
+ }
912
+
913
+ if (networkId == "19" && networkType == "0") {
914
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
915
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
916
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
917
+ jQuery('.xing-url-title[data-network-auth-id="' + networkAuthId + '"]').show();
918
+ jQuery('.xing-url-desc[data-network-auth-id="' + networkAuthId + '"]').show();
919
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
920
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
921
+ } else {
922
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
923
+ jQuery('.xing-url-title[data-network-auth-id="' + networkAuthId + '"]').hide();
924
+ jQuery('.xing-url-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
925
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
926
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
927
+ }
928
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
929
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
930
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
931
+ }
932
+ }
933
+
934
+ } else {
935
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
936
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
937
+ }
938
+
939
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
940
+ if (networkId == 1 && networkType == 0) {
941
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == "1") {
942
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
943
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').hide();
944
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').hide();
945
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').show();
946
+ } else {
947
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
948
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
949
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
950
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + networkAuthId + '"]').hide();
951
+ }
952
+ }
953
+
954
+ //Content Curation
955
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + networkAuthId + '"]').attr('data-post-wp-type') == 'ex') {
956
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
957
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
958
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
959
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
960
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 0) {
961
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
962
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
963
+ } else {
964
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
965
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
966
+ }
967
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
968
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
969
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
970
+ }
971
+ }
972
+ }
973
+
974
+ //XING TOS Group
975
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"').show();
976
+
977
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time
978
+ //delete comment field one more
979
+ if (networkId == 2) {
980
+ if (jQuery('.tw-textarea-input[data-network-id="' + networkId + '"]:visible').length == 1) {
981
+ jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text(jQuery('#b2sTwitterOrginalPost').val());
982
+ } else {
983
+ jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text("");
984
+ }
985
+ }
986
+
987
+ } else {
988
+ jQuery(this).addClass('b2s-network-select-btn-deactivate');
989
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').show();
990
+ jQuery('.b2s-empty-area').hide();
991
+ loadingDummyShow(networkAuthId, jQuery(this).attr('data-network-id'));
992
+ jQuery('.b2s-server-connection-fail').hide();
993
+ var networkId = jQuery(this).attr('data-network-id');
994
+ var legacyMode = jQuery('#isLegacyMode').val();
995
+ if (legacyMode == "1") {
996
+ legacyMode = false; // loading is sync (stack)
997
+ } else {
998
+ legacyMode = true; // loading is async (parallel)
999
+ }
1000
+ jQuery.ajax({
1001
+ url: ajaxurl,
1002
+ type: "POST",
1003
+ dataType: "json",
1004
+ async: legacyMode,
1005
+ cache: false,
1006
+ data: {
1007
+ 'action': 'b2s_ship_item',
1008
+ 'networkAuthId': networkAuthId,
1009
+ 'networkType': jQuery(this).attr('data-network-type'),
1010
+ 'networkKind': jQuery(this).attr('data-network-kind'),
1011
+ 'networkId': networkId,
1012
+ 'networkDisplayName': jQuery(this).attr('data-network-display-name'),
1013
+ 'instantSharing': jQuery(this).attr('data-instant-sharing'),
1014
+ 'networkTosGroupId': jQuery(this).attr('data-network-tos-group-id'),
1015
+ 'userLang': jQuery('#b2sUserLang').val(),
1016
+ 'postId': jQuery('#b2sPostId').val(),
1017
+ 'relayCount': jQuery('#b2sRelayCount').val(),
1018
+ 'selSchedDate': jQuery('#selSchedDate').val(),
1019
+ 'b2sPostType': jQuery('#b2sPostType').val(),
1020
+ 'b2sDraftData': jQuery('#b2sDraftData').val()
1021
+ },
1022
+ beforeSend: function (jqXHR) { // before jQuery send the request we will push it to our array
1023
+ jQuery.xhrPool.push(jqXHR);
1024
+ },
1025
+ complete: function (jqXHR) { // when some of the requests completed it will splice from the array
1026
+ var index = jQuery.xhrPool.indexOf(jqXHR);
1027
+ if (index > -1) {
1028
+ jQuery.xhrPool.splice(index, 1);
1029
+ }
1030
+ },
1031
+ error: function (jqXHR) {
1032
+ var index = jQuery.xhrPool.indexOf(jqXHR);
1033
+ if (index > -1) {
1034
+ jQuery.xhrPool.splice(index, 1);
1035
+ }
1036
+ loadingDummyConnectionFail(networkAuthId, networkId);
1037
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').hide();
1038
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
1039
+ jQuery('.b2s-server-connection-fail').show();
1040
+ return true;
1041
+ },
1042
+ success: function (data) {
1043
+ if (data != undefined) {
1044
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1045
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
1046
+ if (data.result == true) {
1047
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1048
+ var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
1049
+ var pos = order.indexOf(data.networkAuthId.toString());
1050
+ var add = false;
1051
+ for (var i = pos; i >= 0; i--) {
1052
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
1053
+ jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(data.content);
1054
+ i = -1;
1055
+ add = true;
1056
+ }
1057
+ }
1058
+ if (add == false) {
1059
+ jQuery('.b2s-post-list').prepend(data.content);
1060
+ }
1061
+
1062
+ activatePortal(data.networkAuthId);
1063
+ var dateFormat = "yyyy-mm-dd";
1064
+ var language = "en";
1065
+ var showMeridian = true;
1066
+ if (jQuery('#b2sUserLang').val() == "de") {
1067
+ dateFormat = "dd.mm.yyyy";
1068
+ language = "de";
1069
+ showMeridian = false;
1070
+ }
1071
+ var today = new Date();
1072
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
1073
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
1074
+ }
1075
+
1076
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
1077
+ format: dateFormat,
1078
+ language: language,
1079
+ maxViewMode: 2,
1080
+ todayHighlight: true,
1081
+ startDate: today,
1082
+ calendarWeeks: true,
1083
+ autoclose: true
1084
+ });
1085
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
1086
+ minuteStep: 15,
1087
+ appendWidgetTo: 'body',
1088
+ showSeconds: false,
1089
+ showMeridian: showMeridian,
1090
+ defaultTime: today, //'current',
1091
+ snapToStep: true
1092
+ });
1093
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
1094
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1095
+ });
1096
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
1097
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1098
+ });
1099
+ //Check Text Limit
1100
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-text-limit');
1101
+ if (textLimit != "0") {
1102
+ networkLimitAll(data.networkAuthId, data.networkId, textLimit);
1103
+ } else {
1104
+ networkCount(data.networkAuthId);
1105
+ }
1106
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
1107
+ initSceditor(data.networkAuthId);
1108
+ //Bild setzen
1109
+ if (jQuery('#b2s_blog_default_image').val() != "") {
1110
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').length > 0) {
1111
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
1112
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1113
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1114
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="0"]').show();
1115
+ } else {
1116
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1117
+ }
1118
+ }
1119
+ jQuery('.b2s-image-url-hidden-field').val(jQuery('#b2s_blog_default_image').val());
1120
+ }
1121
+
1122
+ //Time zone
1123
+ jQuery('.b2s-settings-time-zone-text').html(jQuery('#user_timezone_text').val());
1124
+ //PostFormat
1125
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0) {
1126
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
1127
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').attr('data-post-format-type');
1128
+ if (jQuery('#user_version').val() >= 2) {
1129
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + data.networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
1130
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
1131
+ var isMetaChecked = false;
1132
+ if (data.networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
1133
+ isMetaChecked = true;
1134
+ }
1135
+ if (data.networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1136
+ isMetaChecked = true;
1137
+ }
1138
+
1139
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1140
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1141
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1142
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
1143
+ if (dataMetaType == "og") {
1144
+ jQuery('#b2sChangeOgMeta').val("1");
1145
+ } else {
1146
+ jQuery('#b2sChangeCardMeta').val("1");
1147
+ }
1148
+
1149
+ //Copy from further item meta tags by same network
1150
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + data.networkId + ']').each(function () {
1151
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != data.networkAuthId) { //other Linkpost by same network
1152
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1153
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1154
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
1155
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1156
+
1157
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
1158
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1159
+ } else {
1160
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1161
+ }
1162
+ return true;
1163
+ }
1164
+ });
1165
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1166
+ if (data.draft == false) {
1167
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1168
+ }
1169
+ } else {
1170
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1171
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1172
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1173
+ }
1174
+
1175
+ if (data.networkId == "3") {
1176
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1177
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1178
+ if (data.draft == false) {
1179
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1180
+ }
1181
+ jQuery('.linkedin-url-title[data-network-auth-id="' + data.networkAuthId + '"]').show();
1182
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + data.networkAuthId + '"]').hide(); // not showing on linkedin
1183
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1184
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1185
+ } else {
1186
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1187
+ jQuery('.linkedin-url-title[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1188
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1189
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1190
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1191
+ }
1192
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1193
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1194
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1195
+ }
1196
+ }
1197
+ if (data.networkId == "19" && data.networkType == "0") {
1198
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1199
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1200
+ if (data.draft == false) {
1201
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1202
+ }
1203
+ jQuery('.xing-url-title[data-network-auth-id="' + data.networkAuthId + '"]').show();
1204
+ jQuery('.xing-url-desc[data-network-auth-id="' + data.networkAuthId + '"]').show();
1205
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1206
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1207
+ } else {
1208
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1209
+ jQuery('.xing-url-title[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1210
+ jQuery('.xing-url-desc[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1211
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1212
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1213
+ }
1214
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1215
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1216
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1217
+ }
1218
+ }
1219
+
1220
+ } else {
1221
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + data.networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
1222
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
1223
+ }
1224
+
1225
+
1226
+ if (jQuery('#selSchedDate').val() != "") {
1227
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1228
+ }
1229
+
1230
+
1231
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
1232
+ if (data.networkId == 1 && data.networkType == 0) {
1233
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == "1") {
1234
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1235
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').hide();
1236
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').hide();
1237
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + data.networkAuthId + '"]').show();
1238
+ } else {
1239
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1240
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"]').show();
1241
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + networkAuthId + '"]').show();
1242
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1243
+ }
1244
+ }
1245
+
1246
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time
1247
+ //delete comment field one more
1248
+ if (data.networkId == 2) {
1249
+ if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length > 1) {
1250
+ var firstAuth = jQuery('.b2s-post-item[data-network-id="' + data.networkId + '"]:first').attr('data-network-auth-id');
1251
+ if (firstAuth != data.networkAuthId) {
1252
+ jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1253
+ } else {
1254
+ if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length > 2) {
1255
+ jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1256
+ }
1257
+ }
1258
+ } else {
1259
+ //set original post
1260
+ jQuery('#b2sTwitterOrginalPost').val(jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').val());
1261
+ }
1262
+ }
1263
+
1264
+ //Content Curation
1265
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-post-wp-type') == 'ex') {
1266
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1267
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1268
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1269
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + data.networkAuthId + '"]').attr("style", "display:none !important");
1270
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == 0) {
1271
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1272
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1273
+ } else {
1274
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1275
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1276
+ }
1277
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1278
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1279
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1280
+ }
1281
+ }
1282
+
1283
+ }
1284
+
1285
+ //Draft
1286
+ if (data.draft == true) {
1287
+ if (data.draftActions.post_format == "0" || data.draftActions.post_format == "1") {
1288
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1289
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').addClass('disabled');
1290
+ jQuery('.b2s-user-network-settings-post-format[value="' + data.draftActions.post_format + '"][data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').trigger('click');
1291
+ }
1292
+
1293
+ jQuery.each(data.draftActions.sched_image_url, function (index, value) {
1294
+ if (value == "") {
1295
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + index + '"]').hide();
1296
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', jQuery('.b2s-network-default-image').val());
1297
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val("");
1298
+ } else {
1299
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', value);
1300
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1301
+ }
1302
+ });
1303
+
1304
+ if (data.draftActions.releaseSelect == "1") {
1305
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1306
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1307
+
1308
+ jQuery.each(data.draftActions.date, function (index, value) {
1309
+ if (index == "1" || index == "2") {
1310
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1311
+ }
1312
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1313
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1314
+ });
1315
+ jQuery.each(data.draftActions.time, function (index, value) {
1316
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1317
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1318
+ });
1319
+ jQuery.each(data.draftActions.sched_content, function (index, value) {
1320
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1321
+ });
1322
+ }
1323
+ if (data.draftActions.releaseSelect == "2") {
1324
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1325
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1326
+
1327
+ jQuery.each(data.draftActions.intervalSelect, function (index, value) {
1328
+ if (index == "1" || index == "2") {
1329
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1330
+ }
1331
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1332
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1333
+ });
1334
+ jQuery.each(data.draftActions.weeks, function (index, value) {
1335
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1336
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1337
+ });
1338
+ jQuery.each(data.draftActions.duration_month, function (index, value) {
1339
+ jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1340
+ jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1341
+ });
1342
+ jQuery.each(data.draftActions.duration_time, function (index, value) {
1343
+ jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1344
+ jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1345
+ });
1346
+ jQuery.each(data.draftActions.select_day, function (index, value) {
1347
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1348
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1349
+ });
1350
+ jQuery.each(data.draftActions.select_timespan, function (index, value) {
1351
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1352
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1353
+ });
1354
+ jQuery.each(data.draftActions.mo, function (index, value) {
1355
+ jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1356
+ });
1357
+ jQuery.each(data.draftActions.di, function (index, value) {
1358
+ jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1359
+ });
1360
+ jQuery.each(data.draftActions.mi, function (index, value) {
1361
+ jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1362
+ });
1363
+ jQuery.each(data.draftActions.do, function (index, value) {
1364
+ jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1365
+ });
1366
+ jQuery.each(data.draftActions.fr, function (index, value) {
1367
+ jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1368
+ });
1369
+ jQuery.each(data.draftActions.sa, function (index, value) {
1370
+ jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1371
+ });
1372
+ jQuery.each(data.draftActions.so, function (index, value) {
1373
+ jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1374
+ });
1375
+ jQuery.each(data.draftActions.date, function (index, value) {
1376
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1377
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1378
+ });
1379
+ jQuery.each(data.draftActions.time, function (index, value) {
1380
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1381
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1382
+ });
1383
+ }
1384
+
1385
+ if (data.draftActions.post_relay == "1") {
1386
+ jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').attr('checked', true);
1387
+ jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1388
+
1389
+ jQuery.each(data.draftActions.post_relay_account, function (index, value) {
1390
+ if (index >= 1) {
1391
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1392
+ }
1393
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1394
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1395
+ });
1396
+ jQuery.each(data.draftActions.post_relay_delay, function (index, value) {
1397
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1398
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1399
+ });
1400
+ }
1401
+
1402
+ jQuery.each(data.draftActions.tags, function (index, value) {
1403
+ if (index >= 1) {
1404
+ jQuery('.ad-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1405
+ }
1406
+ jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val(value);
1407
+ });
1408
+
1409
+ jQuery('.b2s-post-item-details-item-title-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.custom_title);
1410
+
1411
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.url);
1412
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('error');
1413
+
1414
+
1415
+ if (data.networkId == 1) {
1416
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_title);
1417
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_desc);
1418
+ }
1419
+
1420
+ if (data.networkId == 2) {
1421
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_title);
1422
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_desc);
1423
+ }
1424
+
1425
+ if (data.draftActions.image_url == "") {
1426
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1427
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', jQuery('.b2s-network-default-image').val());
1428
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val("");
1429
+ } else {
1430
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', data.draftActions.image_url);
1431
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val(data.draftActions.image_url);
1432
+ }
1433
+ checkSchedDateTime(data.networkAuthId);
1434
+ }
1435
+
1436
+ //XING Groups
1437
+ if (data.networkId == 19 && data.networkType == 2) {
1438
+ if (jQuery('.networkKind[data-network-auth-id="' + data.networkAuthId + '"]').val() == '3') {
1439
+ jQuery('.marketplace_area[data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + data.networkId + '"]').show();
1440
+ }
1441
+ }
1442
+ //XING TOS Group
1443
+ jQuery('.b2s-content-info[data-network-auth-id="' + data.networkAuthId + '"').show();
1444
+
1445
+ } else {
1446
+ //TOS XING Groups
1447
+ if (typeof data.reason !== "undefined") {
1448
+ if (data.reason == 'tos_xing_group_exists') {
1449
+ b2sTosXingGroupCount--;
1450
+ deactivatePortal(data.networkAuthId);
1451
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1452
+ jQuery('#b2s-tos-xing-group-modal').modal('show');
1453
+ return false;
1454
+ }
1455
+ }
1456
+ }
1457
+
1458
+ }
1459
+ }
1460
+ });
1461
+ }
1462
+ } else {
1463
+ //TOS XING Groups
1464
+ if ((networkId == 8 || networkId == 19) && networkType == 2) {
1465
+ b2sTosXingGroupCount--;
1466
+ }
1467
+ deactivatePortal(networkAuthId);
1468
+ }
1469
+ }
1470
+ return false;
1471
+ });
1472
+ jQuery(document).on('click', '.b2s-post-item-details-url-image', function () {
1473
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
1474
+ var networkCountId = jQuery(this).attr("data-network-count");
1475
+ if (jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').is(":visible")) {
1476
+
1477
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1478
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
1479
+ var isMetaChecked = false;
1480
+ if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
1481
+ isMetaChecked = true;
1482
+ }
1483
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1484
+ isMetaChecked = true;
1485
+ }
1486
+
1487
+ if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Faceboo or Twitter
1488
+ jQuery('.meta-text').hide();
1489
+ if (!isMetaChecked) {
1490
+ if (networkId == "1") {
1491
+ jQuery('.isOgMetaChecked').show();
1492
+ } else {
1493
+ jQuery('.isCardMetaChecked').show();
1494
+ }
1495
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1496
+ return false;
1497
+ }
1498
+ }
1499
+
1500
+ jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1501
+ }
1502
+ return false;
1503
+ });
1504
+ jQuery(document).on('click', '.b2s-submit-btn-scroll', function () {
1505
+ jQuery('.b2s-submit-btn').trigger('click');
1506
+ });
1507
+ jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
1508
+ if (jQuery('#user_version').val() >= 1) {
1509
+ jQuery('.b2s-user-network-settings-post-format-area').hide();
1510
+ jQuery('.b2s-user-network-settings-post-format-area[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1511
+ jQuery('#b2s-post-ship-item-post-format-network-title').html(jQuery('.b2s-user-network-settings-post-format-area[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').attr('data-network-title'));
1512
+ if (jQuery('#user_version').val() >= 2) {
1513
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').removeClass('b2s-settings-checked');
1514
+ var currentPostFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
1515
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"][data-post-format="' + currentPostFormat + '"]').addClass('b2s-settings-checked');
1516
+ jQuery('#b2s-post-ship-item-post-format-network-display-name').html(jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').text().toUpperCase());
1517
+ }
1518
+ jQuery('.b2s-post-format-settings-info').hide();
1519
+ jQuery('.b2s-post-format-settings-info[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1520
+ jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
1521
+ jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
1522
+ jQuery('.b2s-user-network-settings-post-format').attr('data-post-wp-type', jQuery(this).attr('data-post-wp-type'));
1523
+ } else {
1524
+ jQuery('#b2sInfoFormatModal').modal('show');
1525
+ }
1526
+ return false;
1527
+ });
1528
+ jQuery(document).on('click', '.b2s-btn-trigger-post-ship-item-post-format', function () {
1529
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1530
+ return false;
1531
+ });
1532
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-days', function () {
1533
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1534
+ });
1535
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-time', function () {
1536
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1537
+ });
1538
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-date', function () {
1539
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1540
+ });
1541
+ jQuery('.b2s-network-details-mandant-select').change(function () {
1542
+ hideDuplicateAuths();
1543
+ chooseMandant();
1544
+ });
1545
+ jQuery(document).on('change', '.b2s-post-item-details-item-group-select', function () {
1546
+ if (jQuery(this).attr('data-change-network-display-name') == 'true') {
1547
+ var label = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
1548
+ jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').html(label);
1549
+ jQuery('.b2s-post-ship-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(label);
1550
+ }
1551
+ //Xing groups
1552
+ if (jQuery(this).attr('data-network-id') == '19') {
1553
+ var option = jQuery('option:selected', this).attr('data-network-kind');
1554
+ if (option == '3') { //Marketplace
1555
+ jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1556
+ } else {
1557
+ jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').hide();
1558
+ }
1559
+ jQuery('.networkKind[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(option);
1560
+ }
1561
+
1562
+ return false;
1563
+ });
1564
+ //select recurrent sched interval mode
1565
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-interval-select', function () {
1566
+ var interval = jQuery(this).val();
1567
+ var selectorInput = '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
1568
+ var dataCount = jQuery(this).attr('data-network-count');
1569
+ releaseChooseInterval(interval, selectorInput, dataCount);
1570
+ return false;
1571
+ });
1572
+ //select shipping mode
1573
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select', function () {
1574
+ var dataNetworkCount = 0;
1575
+ if (jQuery(this).val() == 0) {
1576
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1577
+ if (jQuery(this).attr('data-network-id') == 2) {
1578
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1579
+ }
1580
+ }
1581
+ if (jQuery(this).val() == 2) {
1582
+ if (jQuery(this).attr('data-user-version') == 0) {
1583
+ jQuery('#b2s-sched-post-modal').modal('show');
1584
+ return false;
1585
+ } else {
1586
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1587
+ if (jQuery(this).attr('data-network-id') == 2) {
1588
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1589
+ }
1590
+
1591
+ for (var i = 1; i <= 2; i++) {
1592
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + i + '"]').each(function () {
1593
+ if (jQuery(this).prop('checked')) {
1594
+ dataNetworkCount = 1;
1595
+ }
1596
+ });
1597
+ }
1598
+ if (dataNetworkCount == 2) {
1599
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1600
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1601
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1602
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1603
+ } else if (dataNetworkCount == 1) {
1604
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1605
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1606
+ }
1607
+ }
1608
+ }
1609
+ if (jQuery(this).val() == 1) {
1610
+ if (jQuery(this).attr('data-user-version') == 0) {
1611
+ jQuery('#b2s-sched-post-modal').modal('show');
1612
+ return false;
1613
+ } else {
1614
+
1615
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1616
+ if (jQuery(this).attr('data-network-id') == 2) {
1617
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1618
+ } else {
1619
+ //set orginal edit content for customize sched content
1620
+ var content = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').val();
1621
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(content);
1622
+
1623
+ }
1624
+
1625
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1626
+ if (dataNetworkCount == 2) {
1627
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1628
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1629
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1630
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1631
+ } else if (dataNetworkCount == 1) {
1632
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1633
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1634
+ }
1635
+ }
1636
+ }
1637
+ releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1638
+ });
1639
+ jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
1640
+ jQuery('#b2sSchedPostInfoIgnore').val("1");
1641
+ jQuery('.b2s-submit-btn').trigger("click");
1642
+ return false;
1643
+ });
1644
+ jQuery(document).on('click', '.b2s-re-share-btn', function () {
1645
+ jQuery('.panel-group').removeClass('b2s-border-color-warning');
1646
+ jQuery(".b2s-settings-user-sched-time-area").show();
1647
+ jQuery('#b2s-sidebar-wrapper').show();
1648
+ jQuery('.b2s-post-item-info-area').show();
1649
+ jQuery('.b2s-post-item-details-message-info').show();
1650
+ jQuery('.b2s-post-item-details-edit-area').show();
1651
+ jQuery('.b2s-post-item-details-message-result').hide();
1652
+ jQuery('.b2s-post-item-details-message-result').html("");
1653
+ jQuery(".b2s-post-area").show();
1654
+ jQuery('.b2s-publish-area').show();
1655
+ jQuery('.b2s-footer-menu').show();
1656
+ window.scrollTo(0, 0);
1657
+ jQuery('.b2s-reporting-btn-area').hide();
1658
+ jQuery('#b2sSchedPostInfoIgnore').val("0");
1659
+ //Calendar close for resfresh
1660
+ jQuery('.b2s-toogle-calendar-btn').each(function () {
1661
+ if (!jQuery(this).hasClass('hide')) {
1662
+ var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
1663
+ var currentBtnText = jQuery(this).text();
1664
+ jQuery(this).text(toogleBtnText);
1665
+ jQuery(this).attr('data-toogle-text-btn', currentBtnText);
1666
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1667
+ var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
1668
+ calendar.removeClass('show');
1669
+ calendar.addClass('hide');
1670
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
1671
+ }
1672
+ });
1673
+
1674
+ //TOS XING Group
1675
+ jQuery('.b2s-network-select-btn').each(function () {
1676
+ if (jQuery(this).children().hasClass('active')) {
1677
+ if (jQuery(this).attr('data-network-id') == "19" && jQuery(this).attr('data-network-type') == "2") {
1678
+ b2sTosXingGroupCount--;
1679
+ deactivatePortal(jQuery(this).attr('data-network-auth-id'));
1680
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-network-select-btn-deactivate');
1681
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
1682
+ }
1683
+ }
1684
+ });
1685
+
1686
+ //Approve
1687
+ jQuery('.b2s-post-item-details-post-format').each(function () {
1688
+ if (jQuery(this).attr('data-network-id') == "1" && jQuery(this).attr('data-network-type') == '0' && jQuery(this).val() == "1") {
1689
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').show();
1690
+ }
1691
+ });
1692
+
1693
+ return false;
1694
+ });
1695
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-add', function () {
1696
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1697
+ var netCount = jQuery(this).attr('data-network-count');
1698
+ var networkId = jQuery(this).attr('data-network-id');
1699
+ var networkType = jQuery(this).attr('data-network-type');
1700
+ var netCountNext = parseInt(netCount) + 1;
1701
+ var curMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val();
1702
+ jQuery(this).hide();
1703
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]').hide();
1704
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1705
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1706
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1707
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1708
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1709
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1710
+
1711
+ if (curMode == 1) {
1712
+ //since 4.9.0 custom content
1713
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1714
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1715
+ }
1716
+ //recurrently
1717
+ if (curMode == 2) {
1718
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1719
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1720
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1721
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1722
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1723
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1724
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').val('1');
1725
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1726
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1727
+ //since 4.9.0 custom content
1728
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').hide();
1729
+ }
1730
+
1731
+ return false;
1732
+ });
1733
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-hide', function () {
1734
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1735
+ var netCount = jQuery(this).attr('data-network-count');
1736
+ var netCountBevor = parseInt(netCount) - 1;
1737
+ var selectorInput = '[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]'
1738
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
1739
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1740
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1741
+ //clean all fields
1742
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
1743
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
1744
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).val('');
1745
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
1746
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('checked', false);
1747
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
1748
+ //since 4.9.0 custom content
1749
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput).prop('disabled', true);
1750
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput).removeClass('error');
1751
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
1752
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
1753
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
1754
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
1755
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
1756
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled', true);
1757
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).val("1");
1758
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
1759
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled', true);
1760
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).val("1");
1761
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
1762
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
1763
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled', true);
1764
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).val("1");
1765
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
1766
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled', true);
1767
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).val("1");
1768
+ return false;
1769
+ });
1770
+ jQuery(document).on("keyup", ".complete_network_url", function () {
1771
+ var url = jQuery(this).val();
1772
+ jQuery(this).removeClass("error");
1773
+ if (url.length != "0") {
1774
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
1775
+ url = "http://" + url;
1776
+ jQuery(this).val(url);
1777
+ }
1778
+ } else if (jQuery(this).hasClass("required_network_url")) {
1779
+ if (!(jQuery(this).attr('data-network-id') == 1 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == 1)) { //Facebook Imagepost don't require Link
1780
+ url = jQuery("#b2sDefault_url").val();
1781
+ jQuery(this).val(url);
1782
+ }
1783
+ }
1784
+ });
1785
+ jQuery(document).on('click', '.scroll-to-top', function () {
1786
+ window.scrollTo(0, 0);
1787
+ return false;
1788
+ });
1789
+ jQuery(document).on('click', '.scroll-to-bottom', function () {
1790
+ window.scrollTo(0, document.body.scrollHeight);
1791
+ return false;
1792
+ });
1793
+ jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', function () {
1794
+ var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/);
1795
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1796
+ var url = jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val();
1797
+ if (re.test(url)) {
1798
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
1799
+ jQuery(this).addClass('glyphicon-refresh-animate');
1800
+ jQuery('.b2s-server-connection-fail').hide();
1801
+ jQuery.ajax({
1802
+ url: ajaxurl,
1803
+ type: "POST",
1804
+ dataType: "json",
1805
+ cache: false,
1806
+ data: {
1807
+ 'action': 'b2s_ship_item_reload_url',
1808
+ 'networkId': jQuery(this).attr('data-network-id'),
1809
+ 'networkAuthId': networkAuthId,
1810
+ 'postId': jQuery('#b2sPostId').val(),
1811
+ 'defaultUrl': jQuery('#b2sDefault_url').val(),
1812
+ 'url': url
1813
+ },
1814
+ error: function () {
1815
+ jQuery('.b2s-server-connection-fail').show();
1816
+ return false;
1817
+ },
1818
+ success: function (data) {
1819
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1820
+ if (data.result == true) {
1821
+ if (data.networkId == 3 || data.networkId == 19) { // LI,XI
1822
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').html(data.title);
1823
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').html(data.description);
1824
+ } else {
1825
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1826
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1827
+ }
1828
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1829
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1830
+ }
1831
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '1') {
1832
+ if (data.image != "") {
1833
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1834
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(data.image);
1835
+ } else {
1836
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1837
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1838
+ }
1839
+ }
1840
+ }
1841
+ }
1842
+
1843
+ });
1844
+ } else {
1845
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
1846
+ }
1847
+ });
1848
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1849
+ var metaType = jQuery(this).attr('data-meta-type');
1850
+ var authId = jQuery(this).attr('data-network-auth-id');
1851
+ var countId = jQuery(this).attr('data-network-count');
1852
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').val();
1853
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').attr("data-network-id");
1854
+ var isMetaChecked = false;
1855
+ if (networkId == "1" && jQuery('#isOgMetaChecked').val() == "1") {
1856
+ isMetaChecked = true;
1857
+ }
1858
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1859
+ isMetaChecked = true;
1860
+ }
1861
+
1862
+ if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Facebook or Twitter
1863
+ jQuery('.meta-text').hide();
1864
+ if (!isMetaChecked) {
1865
+ if (networkId == "1") {
1866
+ jQuery('.isOgMetaChecked').show();
1867
+ } else {
1868
+ jQuery('.isCardMetaChecked').show();
1869
+ }
1870
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1871
+ return false;
1872
+ }
1873
+ }
1874
+
1875
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId);
1876
+ jQuery('.b2s-image-change-all-network').attr('data-network-count', countId).attr('data-network-id', networkId);
1877
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId).attr('data-network-count', countId);
1878
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
1879
+ jQuery('.b2s-selected-network-for-image-info').html(content);
1880
+ jQuery('#b2sInsertImageType').val("0");
1881
+ if (typeof metaType !== 'undefined') {
1882
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1883
+ } else {
1884
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1885
+ }
1886
+ //set selected image
1887
+ var selImageVal = jQuery('.b2s-post-item-details-url-image[data-network-count="' + countId + '"][data-network-auth-id="' + authId + '"]').attr('src');
1888
+ jQuery('#b2s-network-select-image').modal('show');
1889
+ jQuery('.checkNetworkImage[data-src="' + selImageVal + '"]').attr('checked', 'checked');
1890
+ imageSize();
1891
+ return false;
1892
+ });
1893
+ jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1894
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1895
+ var networkCountId = jQuery(this).attr('data-network-count');
1896
+ var defaultImage = jQuery('#b2sDefaultNoImage').val();
1897
+ //default
1898
+ if (networkCountId == -1) {
1899
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1900
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1901
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1902
+ } else {
1903
+ //customize sched content
1904
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1905
+ jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
1906
+ jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').hide();
1907
+ }
1908
+
1909
+ //add check linkpost change meta tag image for this network
1910
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1911
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1912
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1913
+ if (postFormat == "0") { //if linkpost
1914
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1915
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1916
+ //override this image with current image
1917
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1918
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1919
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1920
+ }
1921
+ });
1922
+ //customize sched content
1923
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1924
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1925
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1926
+ }
1927
+ }
1928
+
1929
+ return false;
1930
+ });
1931
+ jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1932
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1933
+ var networkCountId = jQuery(this).attr('data-network-count');
1934
+ var networkId = jQuery(this).attr('data-network-id');
1935
+ var currentImage = jQuery('input[name=image_url]:checked').val();
1936
+ if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1937
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1938
+ sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1939
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1940
+ } else {
1941
+ //default
1942
+ if (networkCountId == -1) {
1943
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1944
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1945
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1946
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1947
+ } else {
1948
+ //customize sched content
1949
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1950
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1951
+ jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1952
+ jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').show();
1953
+ }
1954
+
1955
+ if (jQuery(this).attr('data-meta-type') == "og") {
1956
+ jQuery('#b2sChangeOgMeta').val("1");
1957
+ }
1958
+ if (jQuery(this).attr('data-meta-type') == "card") {
1959
+ jQuery('#b2sChangeCardMeta').val("1");
1960
+ }
1961
+
1962
+ //add check linkpost change meta tag image for this network
1963
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1964
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1965
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1966
+ if (networkId != 12) { // ignore for instagram
1967
+ if (postFormat == "0") { //if linkpost
1968
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1969
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1970
+ //override this image with current image
1971
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1972
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1973
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1974
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1975
+ if (networkCountId >= 0) {
1976
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1977
+ }
1978
+ }
1979
+ });
1980
+ //customize sched content
1981
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1982
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1983
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1984
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1985
+ if (networkCountId >= 0) {
1986
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').hide();
1987
+ }
1988
+ }
1989
+ }
1990
+ }
1991
+ }
1992
+ jQuery('.b2s-upload-image-invalid-extension').hide();
1993
+ jQuery('.b2s-upload-image-no-permission').hide();
1994
+ jQuery('.b2s-upload-image-free-version-info').hide();
1995
+ jQuery('#b2s-network-select-image').modal('hide');
1996
+ return false;
1997
+ });
1998
+ jQuery(document).on('change', '.b2s-post-item-details-relay', function () {
1999
+ if (jQuery(this).attr('data-user-version') == 0) {
2000
+ jQuery(this).prop("checked", false);
2001
+ jQuery('#b2sInfoPostRelayModal').modal('show');
2002
+ return false;
2003
+ }
2004
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2005
+ if (jQuery(this).is(":checked")) {
2006
+
2007
+ if (jQuery('#b2sRelayAccountData').val() != "") {
2008
+ jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
2009
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2010
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2011
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2012
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2013
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2014
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
2015
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
2016
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2017
+ //Relay Html Data
2018
+ if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').has('option').length == 0) {
2019
+ var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2020
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').append(optionData);
2021
+ }
2022
+
2023
+ } else {
2024
+ jQuery(this).prop("checked", false);
2025
+ }
2026
+
2027
+ } else {
2028
+ jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2029
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2030
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2031
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2032
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2033
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
2034
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
2035
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2036
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2037
+ }
2038
+ return false;
2039
+ });
2040
+ jQuery(document).on('click', '.b2s-post-item-details-relay-input-add', function () {
2041
+ var netCount = jQuery(this).attr('data-network-count');
2042
+ var netCountNext = parseInt(netCount) + 1;
2043
+ jQuery(this).hide();
2044
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2045
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2046
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2047
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2048
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2049
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
2050
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
2051
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2052
+ jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2053
+ //Relay Html Data
2054
+ if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').has('option').length == 0) {
2055
+ var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2056
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').append(optionData);
2057
+ }
2058
+
2059
+ return false;
2060
+ });
2061
+ jQuery(document).on('click', '.b2s-post-item-details-relay-input-hide', function () {
2062
+ var netCount = jQuery(this).attr('data-network-count');
2063
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2064
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2065
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2066
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2067
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2068
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
2069
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
2070
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide()
2071
+ jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2072
+ if (netCount >= 1) {
2073
+ var before = netCount - 1;
2074
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + before + '"]').show();
2075
+ }
2076
+
2077
+ return false;
2078
+ });
2079
+ jQuery(document).on('click', '.b2s-image-change-all-network', function () {
2080
+ jQuery('.b2s-post-item-details-item-message-input-allow-html').each(function () {
2081
+ var sce = jQuery(this).sceditor('instance');
2082
+ if (typeof sce !== 'undefined' && typeof sce.insert !== 'undefined') {
2083
+ if (sce.getBody().find(".b2s-post-item-details-image-html-src").length > 0) {
2084
+ sce.getBody().find(".b2s-post-item-details-image-html-src").attr('src', jQuery('input[name=image_url]:checked').val());
2085
+ } else {
2086
+ sce.insert("<br /><img class='b2s-post-item-details-image-html-src' src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
2087
+ }
2088
+ }
2089
+ });
2090
+ jQuery('.b2s-post-item-details-url-image[data-network-image-change="1"]').attr('src', jQuery('input[name=image_url]:checked').val());
2091
+ jQuery('#b2s_blog_default_image').val(jQuery('input[name=image_url]:checked').val());
2092
+ jQuery('.b2s-post-item-details-url-image').removeClass('b2s-img-required');
2093
+ jQuery('.b2s-image-url-hidden-field').val(jQuery('input[name=image_url]:checked').val());
2094
+ jQuery('.b2s-image-remove-btn').show();
2095
+ var networkCountId = jQuery(this).attr('data-network-count');
2096
+ if (networkCountId >= 0) {
2097
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"]').hide();
2098
+ }
2099
+
2100
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2101
+ jQuery('.b2s-upload-image-no-permission').hide();
2102
+ jQuery('.b2s-upload-image-free-version-info').hide();
2103
+ jQuery('.b2sChangeOgMeta').val("1");
2104
+ jQuery('.b2sChangeCardMeta').val("1");
2105
+ jQuery('#b2s-network-select-image').modal('hide');
2106
+ return false;
2107
+ });
2108
+ jQuery(document).on('click', '.b2s-upload-image', function () {
2109
+ if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
2110
+ jQuery('#b2s-network-select-image').modal('hide');
2111
+ wpMedia = wp.media({
2112
+ title: jQuery('#b2s_wp_media_headline').val(),
2113
+ button: {
2114
+ text: jQuery('#b2s_wp_media_btn').val(),
2115
+ },
2116
+ multiple: false,
2117
+ library: {type: 'image'}
2118
+ });
2119
+ wpMedia.open();
2120
+ wpMedia.on('select', function () {
2121
+ var validExtensions = ['jpg', 'jpeg', 'png'];
2122
+ var attachment = wpMedia.state().get('selection').first().toJSON();
2123
+ var attachmenUrl = attachment.url;
2124
+ var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
2125
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2126
+ if (jQuery.inArray(attachmenUrlExt, validExtensions) == -1) {
2127
+ jQuery('#b2s-network-select-image').modal('show');
2128
+ jQuery('.b2s-upload-image-invalid-extension').show();
2129
+ jQuery('#b2s-upload-image-invalid-extension-file-name').html('<span class="glyphicon glyphicon-ban-circle"></span> ' + attachment.name + '.' + attachmenUrlExt + '<br>');
2130
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
2131
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2132
+ return false;
2133
+ }
2134
+ var count = parseInt(jQuery('.b2s-choose-image-count').val());
2135
+ count = count + 1;
2136
+ jQuery('.b2s-choose-image-count').val(count);
2137
+ var content = '<div class="b2s-image-item">' +
2138
+ '<div class="b2s-image-item-thumb">' +
2139
+ '<label for="b2s-image-count-' + count + '">' +
2140
+ '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
2141
+ '</label>' +
2142
+ '</div>' +
2143
+ '<div class="b2s-image-item-caption text-center">' +
2144
+ '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
2145
+ '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
2146
+ '</div>' +
2147
+ '</div>';
2148
+ jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
2149
+ jQuery('.b2s-image-change-btn-area').show();
2150
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
2151
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2152
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2153
+ jQuery('input[name=image_url]:last').prop("checked", true);
2154
+ jQuery('#b2s-network-select-image').modal('show');
2155
+ imageSize();
2156
+ });
2157
+ wpMedia.on('close', function () {
2158
+ jQuery('#b2s-network-select-image').modal('show');
2159
+ });
2160
+ } else {
2161
+ jQuery('.b2s-upload-image-no-permission').show();
2162
+ }
2163
+ return false;
2164
+ });
2165
+ jQuery(document).on('click', '.b2s-upload-image-free-version', function () {
2166
+ jQuery('.b2s-upload-image-free-version-info').show();
2167
+ });
2168
+ jQuery("#b2sNetworkSent").keypress(function (e) {
2169
+ if (e.keyCode == 13 && e.target.tagName == "INPUT")
2170
+ return false;
2171
+ });
2172
+ jQuery.validator.addMethod("checkUrl", function (value, element, regexp) {
2173
+ var re = new RegExp(regexp);
2174
+ return this.optional(element) || re.test(value);
2175
+ }, "Invalid Url");
2176
+ jQuery.validator.addClassRules("b2s-post-item-details-item-url-input", {
2177
+ checkUrl: /^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/
2178
+ });
2179
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time ( by all connections)
2180
+ jQuery.validator.addMethod("unique", function (value, element, params) {
2181
+ var curNetworkAuthId = jQuery(element).attr('data-network-auth-id');
2182
+ var curNetworkId = jQuery(element).attr('data-network-id');
2183
+ var prefix = params;
2184
+ var selector = jQuery.validator.format("[name!='{0}'][unique='{1}']", element.name, prefix);
2185
+ var matches = new Array();
2186
+
2187
+ jQuery('.b2s-unique-content[data-network-id="' + curNetworkId + '"]').hide();
2188
+ jQuery('.tw-textarea-input').removeClass('error');
2189
+
2190
+ jQuery(selector).each(function (index, item) {
2191
+ //none disabled elements || ignore default content if curSchedMode=1
2192
+ if (!jQuery(item).is(':not(:disabled)') || !jQuery(item).is(':visible') || !jQuery('.b2s-post-item[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').is(':visible') || (jQuery(item).attr('data-network-count') == -1 && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"] option[value="1"]:selected').length > 0)) {
2193
+ return true;
2194
+ }
2195
+ if (jQuery.trim(value) == jQuery.trim(jQuery(item).val())) {
2196
+ jQuery('.b2s-unique-content[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').show();
2197
+ jQuery('.tw-textarea-input[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').addClass('error');
2198
+ matches.push(item);
2199
+ }
2200
+ });
2201
+ if (matches.length != 0) {
2202
+ jQuery('.b2s-unique-content[data-network-auth-id="' + curNetworkAuthId + '"]').show();
2203
+ }
2204
+ return matches.length == 0;
2205
+ });
2206
+
2207
+
2208
+ jQuery.validator.classRuleSettings.unique = {
2209
+ unique: true
2210
+ };
2211
+ jQuery.validator.addMethod("checkTags", function (value, element, test) {
2212
+ var allowed_tags = ['p', 'h1', 'h2', 'br', 'i', 'b', 'a', 'img'];
2213
+ var tags = value.match(/(<([^>]+)>)/ig);
2214
+ if (tags !== null && tags.length > 0) {
2215
+ if (jQuery(element).hasClass('b2s-post-item-details-item-message-input-allow-html')) {
2216
+ for (var i = 0; i < tags.length; i++) {
2217
+ var allowed_count = 0;
2218
+ for (var e = 0; e < allowed_tags.length; e++) {
2219
+ var regex = new RegExp("<\s*(\/)?" + allowed_tags[e] + "(( [^>]*>)|[>])");
2220
+ if (tags[i].match(regex) != null) {
2221
+ allowed_count = 1;
2222
+ }
2223
+ }
2224
+ if (allowed_count == 0) {
2225
+ return false;
2226
+ }
2227
+ }
2228
+ } else {
2229
+ return false;
2230
+ }
2231
+ }
2232
+ return true;
2233
+ });
2234
+ jQuery.validator.addClassRules('b2s-post-item-details-item-message-input', {'checkTags': true});
2235
+ jQuery.validator.addClassRules('b2s-post-item-details-release-input-date-select', {'checkSched': true});
2236
+ jQuery.validator.addClassRules('b2s-post-item-details-item-title-input', {required: true});
2237
+ jQuery.validator.addMethod('checkSched', function (value, element, rest) {
2238
+ if (jQuery(element).is(':not(:disabled)') && jQuery(element).val() != 0) {
2239
+ var networkAuthId = jQuery(element).attr('data-network-auth-id');
2240
+ if (jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2241
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2242
+ return false;
2243
+ } else {
2244
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2245
+ }
2246
+ if (jQuery(element).val() == 1) {
2247
+ if (jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2248
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2249
+ return false;
2250
+ } else {
2251
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2252
+ }
2253
+
2254
+ } else {
2255
+ var maxCount = jQuery('.b2s-post-item-details-release-input-daySelect[data-network-auth-id="' + networkAuthId + '"]').length;
2256
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2257
+ var daySelect = false;
2258
+ var daySelectErrorCount = 0;
2259
+ for (var count = 0; count < maxCount; count++) {
2260
+ if (jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').is(':not(:disabled)')) {
2261
+ daySelect = false;
2262
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').each(function () {
2263
+ if (jQuery(this).is(':checked')) {
2264
+ daySelect = true;
2265
+ }
2266
+ });
2267
+ if (daySelect === false) {
2268
+ daySelectErrorCount += 1;
2269
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').addClass('error');
2270
+ }
2271
+ }
2272
+ }
2273
+ if (daySelectErrorCount != 0) {
2274
+ return false;
2275
+ }
2276
+ }
2277
+ }
2278
+ return true;
2279
+ });
2280
+ jQuery("#b2sNetworkSent").validate({
2281
+ ignore: "",
2282
+ errorPlacement: function () {
2283
+ return false;
2284
+ },
2285
+ submitHandler: function (form) {
2286
+ if (checkNetworkSelected() == false) {
2287
+ return false;
2288
+ }
2289
+ if (checkPostSchedOnBlog() == false) {
2290
+ return false;
2291
+ }
2292
+ if (checkImageByImageNetworks() == false) {
2293
+ return false;
2294
+ }
2295
+
2296
+ var userDate = new Date();
2297
+ var pubDate = userDate.getFullYear() + "-" + padDate(userDate.getMonth() + 1) + "-" + padDate(userDate.getDate()) + " " + padDate(userDate.getHours()) + ":" + padDate(userDate.getMinutes()) + ":" + padDate(userDate.getSeconds());
2298
+ jQuery('#publish_date').val(pubDate);
2299
+ jQuery(".b2s-loading-area").show();
2300
+ jQuery(".b2s-post-area").hide();
2301
+ jQuery(".b2s-settings-user-sched-time-area").hide();
2302
+ jQuery('#b2s-sidebar-wrapper').hide();
2303
+ jQuery('.b2s-post-item-info-area').hide();
2304
+ jQuery.xhrPool.abortAll();
2305
+ jQuery('.b2s-server-connection-fail').hide();
2306
+ jQuery.ajax({
2307
+ processData: false,
2308
+ url: ajaxurl,
2309
+ type: "POST",
2310
+ dataType: "json",
2311
+ cache: false,
2312
+ data: jQuery(form).serialize(),
2313
+ error: function () {
2314
+ jQuery('.b2s-server-connection-fail').show();
2315
+ return false;
2316
+ },
2317
+ success: function (data) {
2318
+ var content = data.content;
2319
+ jQuery(".b2s-loading-area").hide();
2320
+ for (var i = 0; i < content.length; i++) {
2321
+ jQuery('.b2s-post-item-details-message-info[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2322
+ jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2323
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
2324
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
2325
+ jQuery('.b2s-post-approve-info').hide();
2326
+ jQuery('.b2s-content-info').hide();
2327
+ if (typeof content[i]['approve'] !== typeof undefined) {
2328
+ jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
2329
+ }
2330
+ }
2331
+ jQuery(".b2s-post-area").show();
2332
+ jQuery('.b2s-publish-area').hide();
2333
+ jQuery('.b2s-footer-menu').hide();
2334
+ window.scrollTo(0, 0);
2335
+ jQuery('.b2s-empty-area').hide();
2336
+ jQuery('.b2s-reporting-btn-area').show();
2337
+ wp.heartbeat.connectNow();
2338
+ }
2339
+ });
2340
+ return false;
2341
+ }
2342
+ });
2343
+ jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
2344
+ jQuery('.b2s-network-list-modal-mandant').html(jQuery(".b2s-network-details-mandant-select option:selected").text());
2345
+ });
2346
+ jQuery(window).on("load", function () {
2347
+ var showMeridian = true;
2348
+ if (jQuery('#b2sUserLang').val() == 'de') {
2349
+ showMeridian = false;
2350
+ }
2351
+ jQuery('.b2s-settings-sched-item-input-time').timepicker({
2352
+ minuteStep: 30,
2353
+ appendWidgetTo: 'body',
2354
+ showSeconds: false,
2355
+ showMeridian: showMeridian,
2356
+ defaultTime: 'current'
2357
+ });
2358
+ });
2359
+
2360
+ jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
2361
+ var selectedAuth = new Array();
2362
+ jQuery('.b2s-network-list.active').each(function () {
2363
+ selectedAuth.push(jQuery(this).parents('.b2s-network-select-btn').attr('data-network-auth-id'));
2364
+ });
2365
+ jQuery('.b2s-server-connection-fail').hide();
2366
+ jQuery.ajax({
2367
+ url: ajaxurl,
2368
+ type: "POST",
2369
+ dataType: "json",
2370
+ cache: false,
2371
+ data: {
2372
+ 'action': 'b2s_ship_navbar_save_settings',
2373
+ 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
2374
+ 'selectedAuth': selectedAuth
2375
+ },
2376
+ error: function () {
2377
+ jQuery('.b2s-server-connection-fail').show();
2378
+ return false;
2379
+ },
2380
+ success: function (data) {
2381
+ if (data.result == true) {
2382
+ jQuery('.b2s-ship-settings-save').show();
2383
+ window.scrollTo(0, 0);
2384
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2385
+ jQuery('.b2s-network-list').each(function () {
2386
+ var jsonMandantIds = jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2387
+ if (jsonMandantIds !== undefined) {
2388
+ var jsonMandantIds = jQuery.parseJSON(jsonMandantIds);
2389
+ if (jsonMandantIds.indexOf(mandantId) !== -1 && !jQuery(this).hasClass('active')) {
2390
+ //remove
2391
+ var newMandant = new Array();
2392
+ jQuery(jsonMandantIds).each(function (index, item) {
2393
+ if (item !== mandantId) {
2394
+ newMandant.push(item);
2395
+ }
2396
+ });
2397
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(newMandant));
2398
+ } else if (jsonMandantIds.indexOf(mandantId) == -1 && jQuery(this).hasClass('active')) {
2399
+ //add
2400
+ jsonMandantIds.push(mandantId);
2401
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(jsonMandantIds));
2402
+ }
2403
+ }
2404
+ });
2405
+ }
2406
+ }
2407
+ });
2408
+ });
2409
+ window.addEventListener('message', function (e) {
2410
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
2411
+ var data = JSON.parse(e.data);
2412
+ if (typeof data.action !== typeof undefined && data.action == 'approve') {
2413
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + data.networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2414
+ jQuery.ajax({
2415
+ url: ajaxurl,
2416
+ type: "POST",
2417
+ cache: false,
2418
+ async: false,
2419
+ data: {
2420
+ 'action': 'b2s_update_approve_post',
2421
+ 'post_id': data.post_id,
2422
+ 'publish_link': data.publish_link,
2423
+ 'publish_error_code': data.publish_error_code,
2424
+ },
2425
+ success: function (data) {
2426
+ }
2427
+ });
2428
+ } else {
2429
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
2430
+ }
2431
+ }
2432
+ });
2433
+
2434
+ jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
2435
+ var postId = jQuery('#b2s-approve-post-id').val();
2436
+ var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
2437
+ if (postId > 0) {
2438
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2439
+ jQuery('.b2s-publish-approve-modal').modal('hide');
2440
+ jQuery.ajax({
2441
+ url: ajaxurl,
2442
+ type: "POST",
2443
+ cache: false,
2444
+ async: false,
2445
+ data: {
2446
+ 'action': 'b2s_update_approve_post',
2447
+ 'post_id': postId,
2448
+ 'publish_link': "",
2449
+ 'publish_error_code': "",
2450
+ },
2451
+ success: function (data) {
2452
+ }
2453
+ });
2454
+ }
2455
+ });
2456
+
2457
+
2458
+
2459
+ jQuery.xhrPool.abortAll = function () { // our abort function
2460
+ jQuery(this).each(function (idx, jqXHR) {
2461
+ jqXHR.abort();
2462
+ });
2463
+ jQuery.xhrPool.length = 0
2464
+ };
2465
+ function loadingDummyShow(networkAuthId, networkId) {
2466
+ jQuery('.b2s-post-item-connection-fail-dummy[data-network-auth-id="' + networkAuthId + '"]').remove();
2467
+ var html = '<div class="b2s-post-item b2s-post-item-loading-dummy" data-network-auth-id="' + networkAuthId + '">'
2468
+ + '<div class="panel panel-group">'
2469
+ + '<div class="panel-body">'
2470
+ + '<div class="b2s-post-item-area">'
2471
+ + '<div class="b2s-post-item-details">'
2472
+ + '<div class="b2s-loader-impulse b2s-loader-impulse-md b2s-post-item-loading-impulse-area">'
2473
+ + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2474
+ + '</div>'
2475
+ + '<div class="clearfix"></div>'
2476
+ + '<div class="text-center"><small>'
2477
+ + jQuery('#b2sJsTextLoading').val()
2478
+ + '</small></div>'
2479
+ + '</div>'
2480
+ + '</div>'
2481
+ + '</div>'
2482
+ + '</div>';
2483
+ var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
2484
+ var pos = order.indexOf(networkAuthId.toString());
2485
+ var add = false;
2486
+ for (var i = pos; i >= 0; i--) {
2487
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
2488
+ jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(html);
2489
+ i = -1;
2490
+ add = true;
2491
+ }
2492
+ }
2493
+ if (add == false) {
2494
+ jQuery('.b2s-post-list').prepend(html);
2495
+ }
2496
+ }
2497
+
2498
+ function loadingDummyConnectionFail(networkAuthId, networkId) {
2499
+ var html = '<div class="b2s-post-item b2s-post-item-connection-fail-dummy" data-network-auth-id="' + networkAuthId + '">'
2500
+ + '<div class="panel panel-group">'
2501
+ + '<div class="panel-body">'
2502
+ + '<div class="b2s-post-item-area">'
2503
+ + '<div class="b2s-post-item-details">'
2504
+ + '<div class="b2s-post-item-details-portal-img-area">'
2505
+ + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2506
+ + '</div>'
2507
+ + '<div class="clearfix"></div>'
2508
+ + '<div class="text-center"><small>'
2509
+ + jQuery('#b2sJsTextConnectionFail').val()
2510
+ + '</small>'
2511
+ + '<br/>'
2512
+ + '<a class="btn btn-link btn-sm" target="_blank" href="' + jQuery('#b2sJsTextConnectionFailLink').val() + '">' + jQuery('#b2sJsTextConnectionFailLinkText').val() + '</a>'
2513
+ + '</div>'
2514
+ + '</div>'
2515
+ + '</div>'
2516
+ + '</div>'
2517
+ + '</div>';
2518
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + networkAuthId + '"]').replaceWith(html);
2519
+ }
2520
+
2521
+ function init(firstrun) {
2522
+ var dateFormat = "yyyy-mm-dd";
2523
+ var language = "en";
2524
+ var showMeridian = true;
2525
+ if (jQuery('#b2sUserLang').val() == "de") {
2526
+ dateFormat = "dd.mm.yyyy";
2527
+ language = "de";
2528
+ showMeridian = false;
2529
+ }
2530
+ var today = new Date();
2531
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
2532
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
2533
+ }
2534
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
2535
+ format: dateFormat,
2536
+ language: language,
2537
+ maxViewMode: 2,
2538
+ todayHighlight: true,
2539
+ startDate: today,
2540
+ calendarWeeks: true,
2541
+ autoclose: true
2542
+ });
2543
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
2544
+ minuteStep: 15,
2545
+ appendWidgetTo: 'body',
2546
+ showSeconds: false,
2547
+ showMeridian: showMeridian,
2548
+ defaultTime: 'current',
2549
+ snapToStep: true
2550
+ });
2551
+ checkNetworkSelected();
2552
+ //imageCheck();
2553
+ if (firstrun == true) {
2554
+ jQuery(window).scroll(function () {
2555
+ submitArea();
2556
+ });
2557
+ jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
2558
+ releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), 0);
2559
+ });
2560
+
2561
+ //V5.0.0 Content Curation set selected Profile
2562
+ if (jQuery(".b2s-network-details-mandant-select option[value='" + jQuery('#selProfile').val() + "']").length > 0) {
2563
+ jQuery('.b2s-network-details-mandant-select').val(jQuery('#selProfile').val());
2564
+ }
2565
+ hideDuplicateAuths();
2566
+ chooseMandant();
2567
+ }
2568
+ }
2569
+
2570
+
2571
+
2572
+ function initSceditor(networkAuthId) {
2573
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2574
+ if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2575
+ sceditor.destroy();
2576
+ }
2577
+
2578
+ jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor({
2579
+ plugins: 'xhtml',
2580
+ toolbar: "h1,h2,bold,italic,link,unlink,custom-image|source",
2581
+ autoUpdate: true,
2582
+ emoticonsEnabled: false
2583
+ });
2584
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2585
+ if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2586
+ sceditor.keyUp(function () {
2587
+ jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(jQuery(this).prev('.b2s-post-item-details-item-message-input').sceditor('instance').getBody().text().length);
2588
+ });
2589
+ jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').next('.sceditor-container').find('textarea').on('keyup', function () {
2590
+ var tmp = document.createElement("DIV");
2591
+ tmp.innerHTML = jQuery(this).val();
2592
+ jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(tmp.innerText.length);
2593
+ });
2594
+ }
2595
+
2596
+
2597
+ }
2598
+
2599
+ function submitArea() {
2600
+ if (jQuery('.b2s-publish-area').length > 0) {
2601
+ if (jQuery(window).scrollTop() + jQuery(window.top).height() >= jQuery('.b2s-publish-area').offset().top) {
2602
+ jQuery(".b2s-footer-menu").hide();
2603
+ } else {
2604
+ jQuery(".b2s-footer-menu").show();
2605
+ }
2606
+ }
2607
+ }
2608
+
2609
+ function imageSize() {
2610
+ jQuery('.networkImage').each(function () {
2611
+ var width = this.naturalWidth;
2612
+ var height = this.naturalHeight;
2613
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
2614
+ if (width == 0)
2615
+ {
2616
+ setTimeout(function () {
2617
+ imageSize();
2618
+ }, 50);
2619
+ }
2620
+ });
2621
+ }
2622
+
2623
+ function navbarDeactivatePortal(reason) {
2624
+ if (reason == "image") {
2625
+ var portale = Array(6, 7, 12);
2626
+ for (var i = 0; i <= portale.length; i++) {
2627
+ jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').addClass('b2s-network-select-btn-deactivate');
2628
+ jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').show();
2629
+ }
2630
+ }
2631
+ }
2632
+
2633
+ function navbarActivatePortal(reason) {
2634
+ if (reason == "image") {
2635
+ var portale = Array(6, 7, 12);
2636
+ for (var i = 0; i <= portale.length; i++) {
2637
+ jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').removeClass('b2s-network-select-btn-deactivate');
2638
+ jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').hide();
2639
+ }
2640
+ }
2641
+ }
2642
+
2643
+ function deactivatePortal(networkAuthId) {
2644
+ var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2645
+ jQuery(selector).hide();
2646
+ jQuery(selector).find('.form-control').each(function () {
2647
+ jQuery(this).attr("disabled", "disabled");
2648
+ });
2649
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2650
+ checkNetworkSelected();
2651
+ submitArea();
2652
+ return true;
2653
+ }
2654
+
2655
+ function activatePortal(networkAuthId, check) {
2656
+ var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2657
+ jQuery(selector).show();
2658
+ jQuery(selector).find('.form-control').each(function () {
2659
+
2660
+ if (!jQuery(this).hasClass('b2s-post-item-details-item-message-input')) {
2661
+ jQuery(this).removeAttr("disabled", "disabled");
2662
+ }
2663
+
2664
+ if ((jQuery(this).hasClass('b2s-post-item-details-release-input-weeks')) ||
2665
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-date')) ||
2666
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-time')) ||
2667
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-days')) ||
2668
+ (jQuery(this).hasClass('b2s-post-item-details-relay-input-delay')) ||
2669
+ (jQuery(this).hasClass('b2s-post-item-details-relay-input-account'))) {
2670
+ if (!jQuery(this).is(':visible')) {
2671
+ jQuery(this).prop('disabled', true);
2672
+ }
2673
+ }
2674
+ });
2675
+ //Customize Content
2676
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
2677
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
2678
+ jQuery(selector).find('.b2s-post-item-details-item-message-input').each(function () {
2679
+ if (jQuery(this).is(':visible')) {
2680
+ jQuery(this).removeAttr("disabled", "disabled");
2681
+ }
2682
+ });
2683
+ } else {
2684
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').removeAttr("disabled", "disabled");
2685
+ }
2686
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().addClass('active').find('.b2s-network-hide').removeClass('b2s-network-hide');
2687
+ checkNetworkSelected();
2688
+ submitArea();
2689
+ }
2690
+
2691
+ function checkNetworkSelected() {
2692
+ //überprüfen ob mindestens ein PostItem vorhanden und sichtbar ist
2693
+ var visible = false;
2694
+ jQuery('.b2s-post-list').find('.b2s-post-item').each(function () {
2695
+ if (jQuery(this).is(":visible")) {
2696
+ visible = true;
2697
+ }
2698
+ });
2699
+ if (jQuery('.b2s-post-list').text().trim() == "" || visible == false) {
2700
+ jQuery('.b2s-publish-area').hide();
2701
+ jQuery('.b2s-footer-menu').hide();
2702
+ jQuery('.b2s-empty-area').show();
2703
+ return false;
2704
+ } else {
2705
+ jQuery('.b2s-publish-area').show();
2706
+ if (jQuery('.b2s-publish-area').length > 0) {
2707
+ if (jQuery(window).scrollTop() + jQuery(window.top).height() < jQuery('.b2s-publish-area').offset().top) {
2708
+ jQuery('.b2s-footer-menu').show();
2709
+ }
2710
+ }
2711
+ jQuery('.b2s-empty-area').hide();
2712
+ return true;
2713
+ }
2714
+ }
2715
+
2716
+ function checkPostSchedOnBlog() {
2717
+ if (jQuery('#b2sBlogPostSchedDate').length > 0 && jQuery('#b2sPostType').val() == "") {
2718
+ if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
2719
+ if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
2720
+ jQuery('#b2s-network-sched-post-info').modal("show");
2721
+ return false;
2722
+ }
2723
+ }
2724
+ }
2725
+ return true;
2726
+ }
2727
+
2728
+ function checkImageByImageNetworks() {
2729
+ var result = true;
2730
+ jQuery('.b2sOnlyWithImage').each(function () {
2731
+ if (jQuery(this).is(":visible")) {
2732
+ if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "") {
2733
+ if (!jQuery('#b2s-network-select-image').hasClass('in')) {
2734
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-img-required');
2735
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
2736
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
2737
+ jQuery('#b2s-network-select-image').modal('show');
2738
+ imageSize();
2739
+ window.scrollTo(0, (jQuery(this).offset().top - 45));
2740
+ }
2741
+ result = false;
2742
+ }
2743
+ }
2744
+ });
2745
+ return result;
2746
+ }
2747
+
2748
+
2749
+ function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
2750
+ var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
2751
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2752
+ if (choose == 0) {
2753
+
2754
+ //since 4.8.0 customize content
2755
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2756
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2757
+
2758
+ //Facebook TOS
2759
+ if (jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').attr('readonly')) {
2760
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').hide();
2761
+ } else {
2762
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').show();
2763
+ }
2764
+
2765
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2766
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2767
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2768
+ jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2769
+ jQuery('.b2s-post-tool-area' + selectorInput).show();
2770
+ }
2771
+
2772
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2773
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2774
+ jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2775
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2776
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2777
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2778
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2779
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
2780
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2781
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2782
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2783
+ //monthly- duration month
2784
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2785
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2786
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2787
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2788
+ //monthly- publish day (select-day)
2789
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2790
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2791
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2792
+ //own period- duration times
2793
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2794
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2795
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2796
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2797
+ //own period- timespan
2798
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2799
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2800
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2801
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled');
2802
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2803
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).hide();
2804
+ jQuery('.2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2805
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', true);
2806
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2807
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2808
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2809
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2810
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).hide();
2811
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).hide();
2812
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2813
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2814
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2815
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2816
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).hide();
2817
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2818
+ } else if (choose == 1) {
2819
+
2820
+ //since 4.8.0 customize content
2821
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2822
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').prop('disabled', true);
2823
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').hide();
2824
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').hide();
2825
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').hide();
2826
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').hide();
2827
+ jQuery('.b2s-post-original-area' + selectorInput).removeClass('col-sm-7').removeClass('col-lg-9');
2828
+ jQuery('.b2s-post-tool-area' + selectorInput).hide();
2829
+ //TOS Network Twitter
2830
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-id') == "2") {
2831
+ jQuery('.b2s-post-ship-item-copy-original-text' + selectorInput + '[data-network-count="0"]').trigger('click');
2832
+ }
2833
+ }
2834
+
2835
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2836
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2837
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2838
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2839
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2840
+ for (var i = 0; i <= dataNetworkCount; i++) {
2841
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2842
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2843
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2844
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2845
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2846
+ //since 4.8.0 customize content
2847
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2848
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2849
+ }
2850
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2851
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled');
2852
+ //monthly- duration month
2853
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2854
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2855
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2856
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2857
+ //monthly- publish day (select-day)
2858
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2859
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2860
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2861
+ //own period- duration times
2862
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2863
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2864
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2865
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2866
+ //own period- timespan
2867
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2868
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2869
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2870
+ //new since v.4.5.0
2871
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2872
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2873
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2874
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2875
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2876
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
2877
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2878
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2879
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2880
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).show();
2881
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2882
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2883
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2884
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2885
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2886
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2887
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).show();
2888
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2889
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2890
+ } else if (choose == 2) {
2891
+
2892
+ //since 4.8.0 customize content
2893
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2894
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2895
+
2896
+ //Facebook TOS
2897
+ if (jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').attr('readonly')) {
2898
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').hide();
2899
+ } else {
2900
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').show();
2901
+ }
2902
+
2903
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2904
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2905
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2906
+ jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2907
+ jQuery('.b2s-post-tool-area' + selectorInput).show();
2908
+ }
2909
+
2910
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2911
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2912
+ jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2913
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2914
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2915
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2916
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2917
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2918
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).show();
2919
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2920
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2921
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2922
+ for (var i = 0; i <= dataNetworkCount; i++) {
2923
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2924
+ //new since v4.5.0
2925
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).show();
2926
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2927
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2928
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2929
+ jQuery('.b2s-post-item-details-release-input-daySelect[data-network-count="' + i + '"]' + selectorInput).show();
2930
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2931
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2932
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).show();
2933
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2934
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2935
+ }
2936
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).show();
2937
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).show();
2938
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2939
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2940
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).show();
2941
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).show();
2942
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).show();
2943
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2944
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2945
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).show();
2946
+ }
2947
+
2948
+ var showMeridian = true;
2949
+ if (jQuery('#b2sUserLang').val() == 'de') {
2950
+ showMeridian = false;
2951
+ }
2952
+
2953
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
2954
+ minuteStep: 15,
2955
+ appendWidgetTo: 'body',
2956
+ showSeconds: false,
2957
+ showMeridian: showMeridian,
2958
+ defaultTime: 'current',
2959
+ snapToStep: true
2960
+ });
2961
+ }
2962
+
2963
+
2964
+ function releaseChooseInterval(interval, selectorInput, dataCount) {
2965
+ //change view
2966
+ if (interval == 0) { //weekly,default
2967
+ // show
2968
+ //select days
2969
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2970
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
2971
+ //duration weeks
2972
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2973
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2974
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).show();
2975
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2976
+ //hide
2977
+ //monthly- duration month
2978
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2979
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2980
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2981
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2982
+ //monthly- publish day (select-day)
2983
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2984
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2985
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2986
+ //own period- duration times
2987
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2988
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2989
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2990
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2991
+ //own period- timespan
2992
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2993
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2994
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2995
+ }
2996
+
2997
+ if (interval == 1) { //monthly
2998
+ // show
2999
+ //duration month
3000
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3001
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3002
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).show();
3003
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3004
+ //publish day (select-day)
3005
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3006
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3007
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3008
+ //hide
3009
+ //weekly - select days
3010
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3011
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3012
+ //weekly- duration weeks
3013
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3014
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3015
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3016
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3017
+ //own period- duration times
3018
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3019
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3020
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3021
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3022
+ //own period- timespan
3023
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3024
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3025
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3026
+ }
3027
+
3028
+ if (interval == 2) { //own period
3029
+ // show
3030
+ //duration times
3031
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3032
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3033
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).show(); //select
3034
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled'); //select
3035
+ //timespan
3036
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3037
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3038
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3039
+ //hide
3040
+ //weekly - select days
3041
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3042
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3043
+ //weekly- duration weeks
3044
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3045
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3046
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3047
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3048
+ //monthly- duration month
3049
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3050
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3051
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3052
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3053
+ //monthly- publish day (select-day)
3054
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3055
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3056
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3057
+ }
3058
+ }
3059
+
3060
+
3061
+
3062
+ function addTag(networkAuthId) {
3063
+ var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3064
+ jQuery(selector).last().after('<input class="form-control b2s-post-item-details-tag-input-elem" data-network-auth-id="' + networkAuthId + '" value="" name="b2s[' + networkAuthId + '][tags][]">');
3065
+ jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3066
+ }
3067
+
3068
+ function removeTag(networkAuthId) {
3069
+ var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3070
+ jQuery(selector).last().remove();
3071
+ if (jQuery(selector).length === 1)
3072
+ jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3073
+ }
3074
+
3075
+ function networkLimitAll(networkAuthId, networkId, limit) {
3076
+
3077
+ var networkCountId = -1; //default;
3078
+ if (jQuery(':focus').length > 0) {
3079
+ var attr = jQuery(':focus').attr('data-network-count');
3080
+ if (typeof attr !== typeof undefined && attr !== false) {
3081
+ networkCountId = attr;
3082
+ }
3083
+ }
3084
+
3085
+ var regX = /(<([^>]+)>)/ig;
3086
+ var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3087
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3088
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3089
+ if (url.length != "0") {
3090
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3091
+ url = "http://" + url;
3092
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3093
+ }
3094
+ } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3095
+ if (!(jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook Imagepost don't require Link
3096
+ url = jQuery("#b2sDefault_url").val();
3097
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3098
+ }
3099
+ }
3100
+
3101
+ var textLength = text.length;
3102
+ var newText = text;
3103
+ if (networkId == "2") { //twitter
3104
+ if (url.length != "0") {
3105
+ limit = limit - 24;
3106
+ }
3107
+ }
3108
+ if (networkId == "3") { //linkedin
3109
+ if (url.length != "0") {
3110
+ limit = limit - url.length;
3111
+ }
3112
+ }
3113
+ if (networkId == "19" && jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-type') == 0 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 1) { //xing
3114
+ if (url.length != "0") {
3115
+ limit = limit - url.length;
3116
+ }
3117
+ }
3118
+
3119
+ if (textLength >= limit) {
3120
+ newText = text.substring(0, limit);
3121
+ var pos = getCaretPos(this);
3122
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val(newText.replace(regX, ""));
3123
+ setCaretPos(this, pos);
3124
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3125
+ var textLength = text.length;
3126
+ }
3127
+ var newLen = limit - textLength;
3128
+ jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(newLen);
3129
+ }
3130
+
3131
+ function networkCount(networkAuthId) {
3132
+
3133
+ var networkCountId = -1; //default;
3134
+ if (jQuery(':focus').length > 0) {
3135
+ var attr = jQuery(':focus').attr('data-network-count');
3136
+ if (typeof attr !== typeof undefined && attr !== false) {
3137
+ networkCountId = attr;
3138
+ }
3139
+ }
3140
+ var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3141
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3142
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3143
+ if (url.length != "0") {
3144
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3145
+ url = "http://" + url;
3146
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3147
+ }
3148
+ } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3149
+ if (!(jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook Imagepost don't require Link
3150
+ url = jQuery("#b2sDefault_url").val();
3151
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3152
+ }
3153
+ }
3154
+ var textLength = text.length;
3155
+ jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3156
+ }
3157
+
3158
+
3159
+ function getCaretPos(domElem) {
3160
+ var pos;
3161
+ if (document.selection) {
3162
+ domElem.focus();
3163
+ var sel = document.selection.createRange();
3164
+ sel.moveStart("character", -domElem.value.length);
3165
+ pos = sel.text.length;
3166
+ } else if (domElem.selectionStart || domElem.selectionStart == "0")
3167
+ pos = domElem.selectionStart;
3168
+ return pos;
3169
+ }
3170
+
3171
+ function setCaretPos(domElem, pos) {
3172
+ if (domElem.setSelectionRange) {
3173
+ domElem.focus();
3174
+ domElem.setSelectionRange(pos, pos);
3175
+ } else if (domElem.createTextRange) {
3176
+ var range = domElem.createTextRange();
3177
+ range.collapse(true);
3178
+ range.moveEnd("character", pos);
3179
+ range.moveStart("character", pos);
3180
+ range.select();
3181
+ }
3182
+ }
3183
+
3184
+ function ucfirst(str) {
3185
+ str += '';
3186
+ return str.charAt(0).toUpperCase() + str.substr(1);
3187
+ }
3188
+
3189
+
3190
+ function hideDuplicateAuths() {
3191
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3192
+ jQuery(this).show();
3193
+ });
3194
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3195
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3196
+ if (jQuery(this).is(":visible")) {
3197
+ var dataNetworkDisplayName = jQuery(this).children('.b2s-network-select-btn').attr('data-network-display-name');
3198
+ var dataNetworkId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-id');
3199
+ var dataNetworkType = jQuery(this).children('.b2s-network-select-btn').attr('data-network-type');
3200
+ var dataNetworkAuthId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-auth-id');
3201
+ jQuery('.b2s-network-select-btn[data-network-display-name="' + dataNetworkDisplayName + '"][data-network-id="' + dataNetworkId + '"][data-network-type="' + dataNetworkType + '"][data-network-auth-id!="' + dataNetworkAuthId + '"]').each(function () {
3202
+ var selectedDataMandantId = jQuery.parseJSON(jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id'));
3203
+ if (jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-default-id') != mandantId && selectedDataMandantId.indexOf(mandantId) == -1) {
3204
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').hide();
3205
+ }
3206
+ });
3207
+ }
3208
+ });
3209
+ }
3210
+
3211
+ function chooseMandant() {
3212
+ //Laden abbrechen und anzeige zurück setzten
3213
+ jQuery.xhrPool.abortAll();
3214
+ jQuery('.b2s-post-item-loading-dummy').remove();
3215
+ jQuery('.b2s-network-status-img-loading').hide();
3216
+ jQuery('.b2s-network-select-btn-deactivate').removeClass('b2s-network-select-btn-deactivate');
3217
+ //imageCheck();
3218
+ //TOS XING Groups
3219
+ b2sTosXingGroupCount = 0;
3220
+ //expiredDate wieder setzten
3221
+ jQuery('.b2s-network-status-expiredDate').each(function () {
3222
+ if (jQuery(this).is(':visible')) {
3223
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').addClass('b2s-network-select-btn-deactivate');
3224
+ }
3225
+ });
3226
+ jQuery('.b2s-network-select-btn-deactivate')
3227
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3228
+ jQuery('.b2s-post-item').hide();
3229
+ jQuery('.b2s-post-item').find('.form-control').each(function () {
3230
+ jQuery(this).attr("disabled", "disabled");
3231
+ jQuery(this).removeClass('error');
3232
+ });
3233
+ jQuery('.b2s-network-select-btn').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
3234
+ //Check IS RE-PUBLISH
3235
+ if (jQuery('#b2sSelectedNetworkAuthId').val() > 0 && jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").length > 0) { //exisits?
3236
+ jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").trigger('click');
3237
+ var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3238
+ jQuery('.b2s-network-details-mandant-select').val(mandantId);
3239
+ jQuery('#b2sSelectedNetworkAuthId').val("0");
3240
+ } else {
3241
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3242
+ var mandantIds = jQuery.parseJSON(jQuery(this).attr('data-mandant-id'));
3243
+ if (mandantIds.indexOf(mandantId) != -1 && !jQuery(this).children('.b2s-network-select-btn').hasClass('b2s-network-select-btn-deactivate')) {
3244
+ jQuery(this).children('.b2s-network-select-btn').trigger('click');
3245
+ }
3246
+ });
3247
+ }
3248
+
3249
+ checkNetworkSelected();
3250
+ }
3251
+
3252
+ function padDate(n) {
3253
+ return ("0" + n).slice(-2);
3254
+ }
3255
+
3256
+ function wop(url, name) {
3257
+ jQuery('.b2s-network-auth-success').hide();
3258
+ var location = window.location.protocol + '//' + window.location.hostname;
3259
+ url = encodeURI(url + '&mandant_id=' + jQuery('.b2s-network-details-mandant-select').val() + '&location=' + location);
3260
+ window.open(url, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3261
+ }
3262
+
3263
+
3264
+ function wopApprove(networkAuthId, postId, url, name) {
3265
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
3266
+ var win = window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3267
+ if (postId > 0) {
3268
+ function checkIfWinClosed(intervalID) {
3269
+ if (win.closed) {
3270
+ clearInterval(intervalID);
3271
+ //Show Modal
3272
+ jQuery('.b2s-publish-approve-modal').modal('show');
3273
+ jQuery('#b2s-approve-post-id').val(postId);
3274
+ jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
3275
+ }
3276
+ }
3277
+ var interval = setInterval(function () {
3278
+ checkIfWinClosed(interval);
3279
+ }, 500);
3280
+ }
3281
+ }
3282
+
3283
+
3284
+ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId) {
3285
+ jQuery('.b2s-network-auth-success').show();
3286
+ jQuery('#b2s-network-list-modal').modal('hide');
3287
+ jQuery('#b2s-network-list-modal').hide();
3288
+ jQuery('body').removeClass('modal-open');
3289
+ jQuery('body').removeAttr('style');
3290
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3291
+ jQuery('.b2s-server-connection-fail').hide();
3292
+ jQuery.ajax({
3293
+ url: ajaxurl,
3294
+ type: "POST",
3295
+ dataType: "json",
3296
+ cache: false,
3297
+ data: {
3298
+ 'action': 'b2s_ship_navbar_item',
3299
+ 'networkId': networkId,
3300
+ 'networkType': networkType,
3301
+ 'displayName': displayName,
3302
+ 'networkAuthId': networkAuthId,
3303
+ 'mandandId': mandandId
3304
+ },
3305
+ error: function () {
3306
+ jQuery('.b2s-server-connection-fail').show();
3307
+ return false;
3308
+ },
3309
+ success: function (data) {
3310
+ if (data.result == true) {
3311
+ jQuery(data.content).insertAfter('.b2s-sidbar-network-auth-btn');
3312
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
3313
+ }
3314
+ }
3315
+ });
3316
+ } else {
3317
+ jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + networkAuthId + '"]').remove();
3318
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
3319
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
3320
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-display-name', displayName);
3321
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"] > .b2s-network-list > .b2s-network-details > h4').text(displayName);
3322
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
3323
+ }
3324
+ }
3325
+
3326
+ //jQuery(this).attr('data-network-auth-id')
3327
+ function checkSchedDateTime(dataNetworkAuthId) {
3328
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
3329
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
3330
+ var dateStr = jQuery(dateElement).val();
3331
+ var minStr = jQuery(timeElement).val();
3332
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
3333
+ if (jQuery('#b2sUserLang').val() == 'de') {
3334
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
3335
+ } else {
3336
+ var minParts = minStr.split(' ');
3337
+ var minParts2 = minParts[0].split(':');
3338
+ if (minParts[1] == 'PM') {
3339
+ minParts2[0] = parseInt(minParts2[0]) + 12;
3340
+ }
3341
+ minStr = minParts2[0] + ':' + minParts2[1];
3342
+ }
3343
+
3344
+ var minParts3 = minStr.split(':');
3345
+ if (minParts3[0] < 10) {
3346
+ minParts3[0] = '0' + minParts3[0];
3347
+ }
3348
+ var dateParts = dateStr.split('-');
3349
+ //utc current time
3350
+ var now = new Date();
3351
+ //offset between utc und user
3352
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
3353
+ //enter hour to user time
3354
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
3355
+ //calculate datetime in utc
3356
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
3357
+ //compare enter date time with allowed user time
3358
+ if (enter.getTime() < now.getTime()) {
3359
+ //enter set on next 15 minutes and calculate on user timezone
3360
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
3361
+ jQuery(dateElement).datepicker('update', enter);
3362
+ jQuery(timeElement).timepicker('setTime', enter);
3363
+ }
3364
+
3365
+ //network deprecated
3366
+ if (jQuery(dateElement).attr('data-network-id') == '8') {
3367
+ var deprecatedDate = new Date('2019-03-30T23:59:59');
3368
+ var count = jQuery(dateElement).attr('data-network-count');
3369
+ if (enter.getTime() > deprecatedDate.getTime()) {
3370
+ jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3371
+ jQuery(dateElement).datepicker('update', now);
3372
+ jQuery(timeElement).timepicker('setTime', now);
3373
+ }
3374
+ }
3375
+
3376
+ //network deprecated
3377
+ if (jQuery(dateElement).attr('data-network-id') == '10') {
3378
+ var deprecatedDate = new Date('2019-04-01T23:59:59');
3379
+ var count = jQuery(dateElement).attr('data-network-count');
3380
+ if (enter.getTime() > deprecatedDate.getTime()) {
3381
+ jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3382
+ jQuery(dateElement).datepicker('update', now);
3383
+ jQuery(timeElement).timepicker('setTime', now);
3384
+ }
3385
+ }
3386
+
3387
+ }
3388
+
3389
+ jQuery(document).on("click", ".b2s-draft-btn", function (event) {
3390
+ event.preventDefault();
3391
+ jQuery('.b2s-loader-btn-ship').css('display', 'inline-block');
3392
+ jQuery('.b2s-submit-btn').prop('disabled', true);
3393
+ jQuery('.b2s-submit-btn-scroll').prop('disabled', true);
3394
+ jQuery('.b2s-post-draft-saved-success').hide();
3395
+ jQuery('.b2s-post-draft-saved-fail').hide();
3396
+ jQuery('.b2s-server-connection-fail').hide();
3397
+
3398
+ jQuery.ajax({
3399
+ url: ajaxurl,
3400
+ type: "GET",
3401
+ cache: false,
3402
+ data: {
3403
+ action: 'b2s_check_draft_exists',
3404
+ postId: jQuery('#post_id').val()
3405
+ },
3406
+ error: function () {
3407
+ saveDraft();
3408
+ return false;
3409
+ },
3410
+ success: function (data) {
3411
+ result = JSON.parse(data);
3412
+ if (result.result == true) {
3413
+ jQuery('#b2s-save-draft-modal').modal('show');
3414
+ return true;
3415
+ }
3416
+ saveDraft();
3417
+ return false;
3418
+ }
3419
+ });
3420
+
3421
+ });
3422
+
3423
+ jQuery(document).on('click', '.b2s-draft-btn-scroll', function () {
3424
+ jQuery('.b2s-draft-btn').trigger('click');
3425
+ });
3426
+
3427
+ function saveDraft() {
3428
+ jQuery('#action').val('b2s_save_draft_data');
3429
+ var data = jQuery('#b2sNetworkSent').serialize();
3430
+ jQuery('#action').val('b2s_save_ship_data');
3431
+ jQuery.ajax({
3432
+ url: ajaxurl,
3433
+ type: "POST",
3434
+ cache: false,
3435
+ data: data,
3436
+ error: function () {
3437
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3438
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3439
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3440
+ jQuery('.b2s-server-connection-fail').show();
3441
+ window.scrollTo(0, 0);
3442
+ return false;
3443
+ },
3444
+ success: function (data) {
3445
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3446
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3447
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3448
+ result = JSON.parse(data);
3449
+ if (result.result == true) {
3450
+ jQuery('.b2s-post-draft-saved-success').show();
3451
+ window.setTimeout(function () {
3452
+ jQuery('.b2s-post-draft-saved-success').fadeOut();
3453
+ }, 5000);
3454
+ } else {
3455
+ jQuery('.b2s-post-draft-saved-fail').show();
3456
+ window.setTimeout(function () {
3457
+ jQuery('.b2s-post-draft-saved-fail').fadeOut();
3458
+ }, 5000);
3459
+ }
3460
+ window.scrollTo(0, 0);
3461
+ return true;
3462
+ }
3463
+ });
3464
+ }
3465
+
3466
+ jQuery('#b2s-save-draft-modal').on('hidden.bs.modal', function () {
3467
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3468
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3469
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3470
+ });
3471
+
3472
+ jQuery(document).on('click', '.b2s-save-draft-confirm-btn', function () {
3473
+ saveDraft();
3474
+ jQuery('#b2s-save-draft-modal').modal('hide');
3475
+ return true;
3476
+ });
blog2social.php CHANGED
@@ -2,16 +2,16 @@
2
  /*
3
  * Plugin Name:Blog2Social: Social Media Auto Post & Scheduler
4
  * Plugin URI: https://www.blog2social.com
5
- * Description:Auto publish, schedule & share posts on social media: Facebook, Twitter, Google+, XING, LinkedIn, Instagram, ... crosspost to pages & groups
6
  * Author: Blog2Social, Adenion
7
  * Text Domain: blog2social
8
  * Domain Path: /languages
9
- * Version: 5.6.1
10
  * Author URI: https://www.blog2social.com
11
  * License: GPL2+
12
  */
13
 
14
- define('B2S_PLUGIN_VERSION', '561');
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__));
2
  /*
3
  * Plugin Name:Blog2Social: Social Media Auto Post & Scheduler
4
  * Plugin URI: https://www.blog2social.com
5
+ * Description:Auto publish, schedule & share posts on social media: Facebook, Twitter, XING, LinkedIn, Instagram, ... crosspost to pages & groups
6
  * Author: Blog2Social, Adenion
7
  * Text Domain: blog2social
8
  * Domain Path: /languages
9
+ * Version: 5.7.0
10
  * Author URI: https://www.blog2social.com
11
  * License: GPL2+
12
  */
13
 
14
+ define('B2S_PLUGIN_VERSION', '570');
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
@@ -1,543 +1,578 @@
1
- <?php
2
-
3
- class Ajax_Get {
4
-
5
- static private $instance = null;
6
-
7
- static public function getInstance() {
8
- if (null === self::$instance) {
9
- self::$instance = new self;
10
- }
11
- return self::$instance;
12
- }
13
-
14
- public function __construct() {
15
- add_action('wp_ajax_b2s_ship_item', array($this, 'getShipItem'));
16
- add_action('wp_ajax_b2s_sort_data', array($this, 'getSortData'));
17
- add_action('wp_ajax_b2s_get_sched_posts_by_user_auth', array($this, 'getSchedPostsByUserAuth'));
18
- add_action('wp_ajax_b2s_get_network_board_and_group', array($this, 'getNetworkBoardAndGroup'));
19
- add_action('wp_ajax_b2s_publish_post_data', array($this, 'getPublishPostData'));
20
- add_action('wp_ajax_b2s_sched_post_data', array($this, 'getSchedPostData'));
21
- add_action('wp_ajax_b2s_approve_post_data', array($this, 'getApprovePostData'));
22
- add_action('wp_ajax_b2s_ship_navbar_item', array($this, 'getNavbarItem'));
23
- add_action('wp_ajax_b2s_post_meta_box', array($this, 'getPostMetaBox'));
24
- add_action('wp_ajax_b2s_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'));
30
- add_action('wp_ajax_b2s_get_calendar_events', array($this, 'getCalendarEvents'));
31
- add_action('wp_ajax_b2s_get_post_edit_modal', array($this, 'getPostEditModal'));
32
- add_action('wp_ajax_b2s_get_calendar_filter_network_auth', array($this, 'getCalendarFilterNetworkAuth'));
33
- add_action('wp_ajax_b2s_get_image_modal', array($this, 'getImageModal'));
34
- add_action('wp_ajax_b2s_get_multi_widget_content', array($this, 'getMultiWidgetContent'));
35
- add_action('wp_ajax_b2s_get_stats', array($this, 'getStats'));
36
- add_action('wp_ajax_b2s_get_blog_post_status', array($this, 'getBlogPostStatus'));
37
- add_action('wp_ajax_b2s_support_systemrequirements', array($this, 'b2sSupportSystemRequirements'));
38
- add_action('wp_ajax_b2s_search_user', array($this, 'searchUser'));
39
- add_action('wp_ajax_b2s_get_select_mandant_user', array($this, 'getSelectMandantUser'));
40
- add_action('wp_ajax_b2s_get_edit_template', array($this, 'getEditTemplateForm'));
41
- }
42
-
43
- public function getBlogPostStatus() {
44
- $status = ($_GET['post_id'] > 0) ? get_post_status($_GET['post_id']) : '';
45
- echo json_encode($status);
46
- wp_die();
47
- }
48
-
49
- public function scrapeUrl() {
50
- if (isset($_POST['url']) && !empty($_POST['url'])) {
51
- $data = B2S_Util::scrapeUrl($_POST['url']);
52
- $scrapeError = ($data !== false) ? false : true;
53
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/View.php');
54
- $curation = new B2S_Curation_View();
55
- $preview = $curation->getCurationPreviewHtml($_POST['url'], $data);
56
- if (!empty($preview)) {
57
- if (isset($_POST['loadSettings']) && filter_var($_POST['loadSettings'], FILTER_VALIDATE_BOOLEAN)) {
58
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getProfileUserAuth', 'token' => B2S_PLUGIN_TOKEN)));
59
- if (isset($result->result) && (int) $result->result == 1 && isset($result->data) && !empty($result->data) && isset($result->data->mandant) && isset($result->data->auth) && !empty($result->data->mandant) && !empty($result->data->auth)) {
60
- echo json_encode(array('result' => true, 'preview' => $preview, 'scrapeError' => $scrapeError, 'settings' => $curation->getShippingDetails($result->data->mandant, $result->data->auth)));
61
- wp_die();
62
- }
63
- echo json_encode(array('result' => false, 'preview' => $preview, 'scrapeError' => $scrapeError, 'error' => 'NO_AUTH'));
64
- wp_die();
65
- } else {
66
- echo json_encode(array('result' => true, 'preview' => $preview, 'scrapeError' => $scrapeError));
67
- wp_die();
68
- }
69
- }
70
- }
71
- echo json_encode(array('result' => false, 'preview' => '', 'scrapeError' => false, 'error' => 'NO_PREVIEW'));
72
- wp_die();
73
- }
74
-
75
- public function getSortData() {
76
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
77
- require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
78
- /* Sort */
79
- $b2sType = isset($_POST['b2sType']) ? trim($_POST['b2sType']) : "";
80
- $b2sPagination = (int) isset($_POST['b2sPagination']) ? $_POST['b2sPagination'] : 1;
81
- $b2sShowPagination = !isset($_POST['b2sShowPagination']) || $_POST['b2sShowPagination'] == 1;
82
- $b2sSortPostTitle = isset($_POST['b2sSortPostTitle']) ? trim(strip_tags($_POST['b2sSortPostTitle'])) : "";
83
- $b2sSortPostAuthor = isset($_POST['b2sSortPostAuthor']) ? trim($_POST['b2sSortPostAuthor']) : "";
84
- $b2sSortPostSchedDate = isset($_POST['b2sSortPostSchedDate']) ? (in_array(trim($_POST['b2sSortPostSchedDate']), array('desc', 'asc')) ? trim($_POST['b2sSortPostSchedDate']) : "") : "";
85
- $b2sSortPostPublishDate = isset($_POST['b2sSortPostPublishDate']) ? (in_array(trim($_POST['b2sSortPostPublishDate']), array('desc', 'asc')) ? trim($_POST['b2sSortPostPublishDate']) : "") : "";
86
- $b2sSortPostStatus = isset($_POST['b2sSortPostStatus']) ? trim($_POST['b2sSortPostStatus']) : "";
87
- $b2sSortPostShareStatus = isset($_POST['b2sSortPostShareStatus']) ? trim($_POST['b2sSortPostShareStatus']) : "";
88
- $b2sShowByDate = isset($_POST['b2sShowByDate']) ? (preg_match("#^[0-9\-.\]]+$#", trim($_POST['b2sShowByDate'])) ? trim($_POST['b2sShowByDate']) : "") : ""; //YYYY-mm-dd
89
- $b2sShowByNetwork = isset($_POST['b2sShowByNetwork']) ? (int) $_POST['b2sShowByNetwork'] : 0;
90
- $b2sUserAuthId = isset($_POST['b2sUserAuthId']) ? (int) $_POST['b2sUserAuthId'] : 0;
91
- $b2sPostBlogId = isset($_POST['b2sPostBlogId']) ? (int) $_POST['b2sPostBlogId'] : 0;
92
- $b2sSortPostCat = isset($_POST['b2sSortPostCat']) ? trim($_POST['b2sSortPostCat']) : "";
93
- $b2sSortPostType = isset($_POST['b2sSortPostType']) ? trim($_POST['b2sSortPostType']) : "";
94
- $b2sSelectSchedDate = isset($_POST['b2sSchedDate']) ? (preg_match("#^[0-9\-.\]]+$#", trim($_POST['b2sSchedDate'])) ? trim($_POST['b2sSchedDate']) : "") : "";
95
- $b2sUserLang = isset($_POST['b2sUserLang']) ? trim(strip_tags($_POST['b2sUserLang'])) : strtolower(substr(B2S_LANGUAGE, 0, 2));
96
- $b2sResultsPerPage = isset($_POST['b2sPostsPerPage']) && intval($_POST['b2sPostsPerPage']) > 0 ? intval($_POST['b2sPostsPerPage']) : B2S_PLUGIN_POSTPERPAGE;
97
- if (!empty($b2sType) && in_array($b2sType, array('all', 'sched', 'publish', 'notice', 'approve', 'draft'))) {
98
- $postItem = new B2S_Post_Item($b2sType, $b2sSortPostTitle, $b2sSortPostAuthor, $b2sSortPostStatus, $b2sSortPostShareStatus, $b2sSortPostPublishDate, $b2sSortPostSchedDate, $b2sShowByDate, $b2sShowByNetwork, $b2sUserAuthId, $b2sPostBlogId, $b2sPagination, $b2sSortPostCat, $b2sSortPostType, $b2sUserLang, $b2sResultsPerPage);
99
- $result = array('result' => true, 'content' => $postItem->getItemHtml($b2sSelectSchedDate), 'schedDates' => json_encode($postItem->getCalendarSchedDate()));
100
- if ($b2sShowPagination) {
101
- $result['pagination'] = $postItem->getPaginationHtml();
102
- }
103
- echo json_encode($result);
104
- wp_die();
105
- }
106
- echo json_encode(array('result' => false, 'content' => '', 'schedDates' => 0, 'pagination' => ''));
107
- wp_die();
108
- }
109
-
110
- public function getNetworkBoardAndGroup() {
111
- if (isset($_POST['networkId']) && !empty($_POST['networkId']) && isset($_POST['networkAuthId']) && !empty($_POST['networkAuthId'])) {
112
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getNetworkBoardAndGroup', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => $_POST['networkAuthId'], 'networkId' => $_POST['networkId'], 'lang' => substr(B2S_LANGUAGE, 0, 2))));
113
- if (is_object($result) && !empty($result) && isset($result->data) && !empty($result->data) && isset($result->result) && (int) $result->result == 1) {
114
- require_once B2S_PLUGIN_DIR . 'includes/Form.php';
115
- echo json_encode(array('result' => true, 'content' => B2S_Form::getNetworkBoardAndGroupHtml($result->data, $_POST['networkId'])));
116
- wp_die();
117
- }
118
- }
119
- echo json_encode(array('result' => false, 'content' => ''));
120
- wp_die();
121
- }
122
-
123
- public function getFaqEntries() {
124
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getFaqEntries', 'lang' => substr(B2S_LANGUAGE, 0, 2), 'token' => B2S_PLUGIN_TOKEN)));
125
- if (isset($result->result) && isset($result->content) && !empty($result->content)) {
126
- echo json_encode(array('result' => true, 'content' => B2S_Notice::getFaqEntriesHtml($result->content)));
127
- wp_die();
128
- }
129
- echo json_encode(array('result' => false, 'content' => ''));
130
- wp_die();
131
- }
132
-
133
- public function getPostMetaBox() {
134
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getProfileUserAuth', 'token' => B2S_PLUGIN_TOKEN)));
135
- if (isset($result->result) && (int) $result->result == 1 && isset($result->data) && !empty($result->data) && isset($result->data->mandant) && isset($result->data->auth) && !empty($result->data->mandant)) {
136
- if (!empty($result->data->auth)) {
137
- $postBox = new B2S_PostBox();
138
- echo json_encode(array('result' => true, 'content' => $postBox->getPostBoxAutoHtml($result->data->mandant, $result->data->auth)));
139
- wp_die();
140
- } else {
141
- echo json_encode(array('result' => false, 'content' => 'no_auth'));
142
- wp_die();
143
- }
144
- }
145
- echo json_encode(array('result' => false, 'content' => ''));
146
- wp_die();
147
- }
148
-
149
- public function getShipItemFullText() {
150
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
151
- $userLang = isset($_POST['userLang']) ? trim($_POST['userLang']) : strtolower(substr(B2S_LANGUAGE, 0, 2));
152
- $data = get_post((int) $_POST['postId']);
153
- if (isset($data->post_content)) {
154
- $postUrl = (get_permalink($data->ID) !== false) ? get_permalink($data->ID) : $data->guid;
155
- $content = trim(B2S_Util::prepareContent($data->ID, $data->post_content, $postUrl, '', false, $userLang));
156
- $networkId = isset($_POST['networkId']) ? (int) $_POST['networkId'] : 0;
157
- echo json_encode(array('result' => true, 'text' => trim(strip_tags($content)), 'networkAuthId' => (int) $_POST['networkAuthId'], 'networkId' => $networkId));
158
- wp_die();
159
- }
160
- }
161
- echo json_encode(array('result' => false));
162
- wp_die();
163
- }
164
-
165
- public function getShipItem() {
166
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
167
- //TOS XING Group
168
- if ((int) $_POST['networkId'] == 19 && isset($_POST['networkTosGroupId']) && !empty($_POST['networkTosGroupId'])) {
169
- $options = new B2S_Options(0, 'B2S_PLUGIN_TOS_XING_GROUP_CROSSPOSTING');
170
- if ($options->existsValueByKey($_POST['postId'], $_POST['networkTosGroupId'])) {
171
- echo json_encode(array('result' => false, 'reason' => 'tos_xing_group_exists', 'networkAuthId' => (int) $_POST['networkAuthId']));
172
- wp_die();
173
- }
174
- }
175
-
176
- $userLang = isset($_POST['userLang']) ? trim($_POST['userLang']) : strtolower(substr(B2S_LANGUAGE, 0, 2));
177
- $relayCount = isset($_POST['relayCount']) ? (int) $_POST['relayCount'] : 0;
178
- require_once B2S_PLUGIN_DIR . 'includes/B2S/Ship/Item.php';
179
- $itemData = array('networkAuthId' => (int) $_POST['networkAuthId'],
180
- 'networkId' => (int) $_POST['networkId'],
181
- 'networkKind' => (int) $_POST['networkKind'],
182
- 'networkTosGroupId' => ((isset($_POST['networkTosGroupId']) && !empty($_POST['networkTosGroupId'])) ? trim($_POST['networkTosGroupId']) : ''),
183
- 'instantSharing' => (isset($_POST['instantSharing']) ? (int) $_POST['instantSharing'] : 0),
184
- 'network_display_name' => strip_tags(stripslashes($_POST['networkDisplayName'])),
185
- 'networkType' => (int) $_POST['networkType']);
186
- $selSchedDate = (isset($_POST['selSchedDate']) && !empty($_POST['selSchedDate'])) ? $_POST['selSchedDate'] : ""; //routing from calendar
187
- $b2sPostType = (isset($_POST['b2sPostType']) && $_POST['b2sPostType'] == 'ex') ? 'ex' : ""; //Content Curation
188
- $item = new B2S_Ship_Item((int) $_POST['postId'], $userLang, $selSchedDate, $b2sPostType, $relayCount);
189
- echo json_encode(array('result' => true, 'networkAuthId' => (int) $_POST['networkAuthId'], 'networkType' => (int) $_POST['networkType'], 'networkId' => (int) $_POST['networkId'], 'content' => $item->getItemHtml((object) $itemData)));
190
- } else {
191
- echo json_encode(array('result' => false));
192
- }
193
- wp_die();
194
- }
195
-
196
- public function getPublishPostData() {
197
- if ((int) $_POST['postId']) {
198
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
199
- require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
200
- $postData = new B2S_Post_Item();
201
- $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
202
- $type = (isset($_POST['type']) && in_array($_POST['type'], array('publish', 'notice'))) ? $_POST['type'] : 'publish';
203
- $result = $postData->getPublishPostDataHtml((int) $_POST['postId'], $type, $showByDate);
204
- if ($result !== false) {
205
- echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
206
- wp_die();
207
- }
208
- }
209
- echo json_encode(array('result' => false));
210
- wp_die();
211
- }
212
-
213
- public function getApprovePostData() {
214
- if ((int) $_POST['postId']) {
215
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
216
- require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
217
- $postData = new B2S_Post_Item();
218
- $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
219
- $result = $postData->getApprovePostDataHtml((int) $_POST['postId'], $showByDate);
220
- if ($result !== false) {
221
- echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
222
- wp_die();
223
- }
224
- }
225
- echo json_encode(array('result' => false));
226
- wp_die();
227
- }
228
-
229
- public function getSchedPostsByUserAuth() {
230
- if ((int) $_POST['networkAuthId']) {
231
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
232
- $networkData = new B2S_Network_Item(false);
233
- global $wpdb;
234
- $blogUserTokenResult = $wpdb->get_results("SELECT token FROM `b2s_user`");
235
- $blogUserToken = array();
236
- foreach ($blogUserTokenResult as $k => $row) {
237
- array_push($blogUserToken, $row->token);
238
- }
239
- $data = array('action' => 'getTeamAssignUserAuth', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $_POST['networkAuthId'], 'blogUser' => $blogUserToken);
240
- $networkAuthAssignment = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30), true);
241
- $count = $networkData->getCountSchedPostsByUserAuth((int) $_POST['networkAuthId']);
242
- if ($networkAuthAssignment['result'] == true) {
243
- $assignCount = 0;
244
- $assignList = array();
245
- foreach ($networkAuthAssignment['assignList'] as $k => $v) {
246
- $assignList[$v['assign_blog_user_id']] = (int) $v['assign_network_auth_id'];
247
- $authCount = $networkData->getCountSchedPostsByUserAuth((int) $v['assign_network_auth_id']);
248
- if ($authCount !== false) {
249
- $assignCount += $authCount;
250
- }
251
- }
252
- echo json_encode(array('result' => true, 'count' => ($count !== false) ? $count : 0, 'assignCount' => $assignCount, 'assignListCount' => count($networkAuthAssignment['assignList']), 'assignList' => serialize($assignList)));
253
- wp_die();
254
- } else {
255
- if ($count !== false) {
256
- echo json_encode(array('result' => true, 'count' => $count));
257
- wp_die();
258
- }
259
- }
260
- }
261
- echo json_encode(array('result' => false, 'count' => 0));
262
- wp_die();
263
- }
264
-
265
- public function getSchedPostData() {
266
- if ((int) $_POST['postId']) {
267
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
268
- require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
269
- $postData = new B2S_Post_Item();
270
- $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
271
- $showByNetwork = isset($_POST['showByNetwork']) ? trim($_POST['showByNetwork']) : '';
272
- $userAuthId = isset($_POST['userAuthId']) ? (int) $_POST['userAuthId'] : 0;
273
- $result = $postData->getSchedPostDataHtml((int) $_POST['postId'], $showByDate, $showByNetwork, $userAuthId);
274
- if ($result !== false) {
275
- echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
276
- wp_die();
277
- }
278
- }
279
- echo json_encode(array('result' => false));
280
- wp_die();
281
- }
282
-
283
- public function getNavbarItem() {
284
- if (isset($_POST['networkId']) && isset($_POST['networkAuthId']) && isset($_POST['networkType']) && isset($_POST['displayName']) && isset($_POST['mandandId'])) {
285
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Ship/Navbar.php');
286
- global $wpdb;
287
- $mandantCount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(mandant_id)FROM b2s_user_network_settings WHERE mandant_id =%d AND blog_user_id=%d ", $_POST['mandandId'], B2S_PLUGIN_BLOG_USER_ID));
288
- if ($mandantCount > 0) {
289
- $wpdb->insert('b2s_user_network_settings', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'mandant_id' => $_POST['mandandId'], 'network_auth_id' => $_POST['networkAuthId']), array('%d', '%d', '%d'));
290
- }
291
- $data = array(
292
- 'networkId' => isset($_POST['networkId']) ? (int) $_POST['networkId'] : 0,
293
- 'networkAuthId' => isset($_POST['networkAuthId']) ? (int) $_POST['networkAuthId'] : 0,
294
- 'networkType' => isset($_POST['networkType']) ? (int) $_POST['networkType'] : 0,
295
- 'networkUserName' => isset($_POST['displayName']) ? strip_tags($_POST['displayName']) : '',
296
- 'mandantId' => isset($_POST['mandandId']) ? (int) $_POST['mandandId'] : 0,
297
- 'expiredDate' => date('Y-m-d', strtotime('+3 days')));
298
-
299
- $navbar = new B2S_Ship_Navbar();
300
- echo json_encode(array('result' => true, 'networkAuthId' => (int) $_POST['networkAuthId'], 'content' => $navbar->getItemHtml((object) $data)));
301
- wp_die();
302
- }
303
- echo json_encode(array('result' => false));
304
- wp_die();
305
- }
306
-
307
- public function getSettingsSchedTimeDefault() {
308
- $userTimes = B2S_Tools::getRandomBestTimeSettings();
309
- if (!empty($userTimes) && is_array($userTimes)) {
310
- echo json_encode(array('result' => true, 'times' => $userTimes));
311
- wp_die();
312
- }
313
- echo json_encode(array('result' => false));
314
- wp_die();
315
- }
316
-
317
- //NEW V5.1.0
318
- public function getUserTimeSettings() {
319
- $lang = substr(B2S_LANGUAGE, 0, 2);
320
- $options = new B2S_Options(get_current_user_id());
321
- $userSchedData = $options->_getOption('auth_sched_time');
322
- if (isset($userSchedData['time'])) {
323
- if (is_array($userSchedData) && isset($userSchedData['delay_day']) && isset($userSchedData['time']) && is_array($userSchedData['time'])) {
324
- foreach ($userSchedData['time'] as $k => $v) {
325
- $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
326
- $userSchedData['time'][$k] = date($slug, strtotime(date('Y-m-d ' . $v . ':00')));
327
- }
328
- echo json_encode(array('result' => true, 'type' => 'new', 'delay_day' => $userSchedData['delay_day'], 'times' => $userSchedData['time']));
329
- wp_die();
330
- }
331
- //load old setttings >5.1.0
332
- } else {
333
- global $wpdb;
334
- //if exists
335
- if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_post_sched_settings'") == 'b2s_post_sched_settings') {
336
- $userTimes = array();
337
- $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));
338
- if (!empty($saveSchedData) && is_array($saveSchedData)) {
339
- foreach ($saveSchedData as $k => $v) {
340
- $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
341
- $userTimes[$v->network_id][$v->network_type] = date($slug, strtotime(date('Y-m-d ' . $v->sched_time . ':00')));
342
- }
343
- if (!empty($userTimes)) {
344
- echo json_encode(array('result' => true, 'type' => 'old', 'times' => $userTimes));
345
- wp_die();
346
- }
347
- }
348
- }
349
- }
350
- echo json_encode(array('result' => false));
351
- wp_die();
352
- }
353
-
354
- public function getShipItemReloadUrl() {
355
- if (isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['url']) && !empty($_POST['url'])) {
356
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['defaultUrl']) && $_POST['defaultUrl'] == $_POST['url']) {
357
- $postData = get_post($_POST['postId']);
358
- if ($postData->post_status != 'publish') {
359
- $postUrl = (get_permalink($postData->ID) !== false ? get_permalink($postData->ID) : $postData->guid);
360
- $metaInfo = array('title' => B2S_Util::getExcerpt(B2S_Util::remove4byte($postData->post_title), 50) . ' - ' . get_option('blogname'), 'description' => B2S_Util::getExcerpt(B2S_Util::prepareContent($postData->ID, $postData->post_content, $postUrl, false, false), 150));
361
- } else {
362
- $metaInfo = B2S_Util::getMetaTags((int) $_POST['postId'], strip_tags($_POST['url']), (int) $_POST['networkId']);
363
- }
364
- } else {
365
- $metaInfo = B2S_Util::getMetaTags(0, strip_tags($_POST['url']), (int) $_POST['networkId']);
366
- }
367
- echo json_encode(array('result' => true, 'networkId' => (int) $_POST['networkId'], 'networkAuthId' => $_POST['networkAuthId'], 'title' => isset($metaInfo['title']) ? $metaInfo['title'] : '', 'description' => isset($metaInfo['description']) ? $metaInfo['description'] : '', 'image' => isset($metaInfo['image']) ? $metaInfo['image'] : ''));
368
- wp_die();
369
- }
370
- echo json_encode(array('result' => false));
371
- wp_die();
372
- }
373
-
374
- public function getCalendarEvents() {
375
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Filter.php');
376
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Image.php');
377
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Settings/Item.php');
378
- require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
379
-
380
- //Filter Network
381
- $network_id = (isset($_GET['filter_network']) && (int) $_GET['filter_network'] >= 1) ? (int) $_GET['filter_network'] : 0; // 0=all
382
- //Filter Network Details
383
- $network_details_id = (isset($_GET['filter_network_auth']) && (int) $_GET['filter_network_auth'] >= 1) ? (int) $_GET['filter_network_auth'] : 0; // 0=all
384
- //Filter Status
385
- $status = (isset($_GET['filter_status']) && (int) $_GET['filter_status'] >= 0) ? (int) $_GET['filter_status'] : 0; // 0=all,1=publish, 2=scheduled
386
-
387
- if (isset($_GET['start'])) {
388
- $calendar = B2S_Calendar_Filter::getByTimespam($_GET['start'] . " 00:00:00", $_GET['end'] . " 23:59:59", $network_id, $network_details_id, $status);
389
- } else {
390
- $calendar = B2S_Calendar_Filter::getAll($network_id, $network_details_id);
391
- }
392
- echo json_encode($calendar->asCalendarArray());
393
- wp_die();
394
- }
395
-
396
- public function getCalendarFilterNetworkAuth() {
397
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Filter.php');
398
- $network_id = (isset($_POST['network_id']) && (int) $_POST['network_id'] >= 1) ? (int) $_POST['network_id'] : 0; // 0=all
399
- if ($network_id != 0) {
400
- $result = B2S_Calendar_Filter::getFilterNetworkAuthHtml($network_id);
401
- if ($result !== false) {
402
- echo json_encode(array('result' => true, 'content' => $result));
403
- wp_die();
404
- }
405
- }
406
- echo json_encode(array('result' => false));
407
- wp_die();
408
- }
409
-
410
- public function getPostEditModal() {
411
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Filter.php');
412
- if (isset($_POST['id']) && (int) $_POST['id'] > 0) {
413
- $item = B2S_Calendar_Filter::getById((int) $_POST['id']);
414
- if ($item != null) {
415
- $lock_user_id = get_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $_POST['id']);
416
- if (!$lock_user_id) {
417
- update_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $_POST['id'], get_current_user_id(), false);
418
- $options = new B2S_Options(get_current_user_id());
419
- $block_old = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
420
-
421
- if ($block_old) {
422
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $block_old);
423
- }
424
- $options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", $_POST['id']);
425
- }
426
- if ($lock_user_id) {
427
- $lock_user = get_userdata($lock_user_id);
428
- }
429
- include (B2S_PLUGIN_DIR . 'views/b2s/partials/post-edit-modal.php');
430
- wp_die();
431
- }
432
- }
433
- echo "0";
434
- wp_die();
435
- }
436
-
437
- public function getImageModal() {
438
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Image.php');
439
- if (isset($_POST['id']) && (int) $_POST['id'] > 0) {
440
- $postData = get_post((int) $_POST['id']);
441
- if (isset($postData->ID)) {
442
- $postUrl = (get_permalink($postData->ID) !== false ? get_permalink($postData->ID) : $postData->guid);
443
- include (B2S_PLUGIN_DIR . 'views/b2s/partials/calendar-image-modal.php');
444
- wp_die();
445
- }
446
- }
447
- echo "0";
448
- wp_die();
449
- }
450
-
451
- public function getMultiWidgetContent() {
452
- $option = get_option("B2S_MULTI_WIDGET");
453
- if ($option !== false) {
454
- if (is_array($option) && isset($option['timestamp']) && isset($option['content']) && !empty($option['content']) && $option['timestamp'] > date('Y-m-d H:i:s', strtotime("-1 hours"))) {
455
- die($option['content']);
456
- }
457
- }
458
- $content = B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getNews', 'version' => B2S_PLUGIN_VERSION, 'lang' => strtolower(substr(get_locale(), 0, 2)), 'token' => B2S_PLUGIN_TOKEN));
459
- update_option("B2S_MULTI_WIDGET", array("timestamp" => date("Y-m-d H:i:s"), "content" => $content), false);
460
- echo $content;
461
- wp_die();
462
- }
463
-
464
- public function getStats() {
465
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Stats.php');
466
- $stats = new B2S_Stats();
467
- if (isset($_GET['from']) && !empty($_GET['from'])) {
468
- $stats->set_from($_GET['from']);
469
- }
470
- echo json_encode($stats->get_result());
471
- wp_die();
472
- }
473
-
474
- public function b2sSupportSystemRequirements() {
475
- if (!current_user_can('administrator')) {
476
- echo json_encode(array('result' => false, 'error' => 'admin'));
477
- wp_die();
478
- }
479
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Support/Check/System.php');
480
- $support = new B2S_Support_Check_System();
481
- $htmlData = $support->htmlData();
482
- $blogData = $support->blogData();
483
- if (empty($htmlData) || empty($blogData)) {
484
- $result = array('result' => false);
485
- } else {
486
- $result = array('result' => true, 'htmlData' => $htmlData, "blogData" => $blogData);
487
- }
488
- echo json_encode($result);
489
- wp_die();
490
- }
491
-
492
- public function searchUser() {
493
- if (isset($_GET['search_user']) && !empty($_GET['search_user'])) {
494
- $options = B2S_Tools::searchUser($_GET['search_user']);
495
- echo json_encode(array('result' => true, 'options' => $options));
496
- wp_die();
497
- }
498
- echo json_encode(array('result' => false));
499
- wp_die();
500
- }
501
-
502
- public function getSelectMandantUser() {
503
- if (isset($_GET['owner']) && (int) $_GET['owner'] > 0) {
504
- $owner = stripslashes(get_user_by('id', $_GET['owner'])->display_name);
505
- $owner = (empty($owner) || $owner == false) ? __("Unknown username", "blog2social") : $owner;
506
- echo json_encode(array('result' => true, 'ownerName' => $owner));
507
- wp_die();
508
- } else {
509
- $networkAuthId = (isset($_GET['networkAuthId']) && (int) $_GET['networkAuthId'] > 0) ? $_GET['networkAuthId'] : 0;
510
- $networkId = (isset($_GET['networkId']) && (int) $_GET['networkId'] > 0) ? $_GET['networkId'] : 0;
511
- $networkType = (isset($_GET['networkType']) && (int) $_GET['networkType'] >= 0) ? $_GET['networkType'] : 0;
512
- if ($networkAuthId > 0 && $networkId > 0) {
513
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
514
- $networkItem = new B2S_Network_Item();
515
- $networkAuthAssignment = $networkItem->getNetworkAuthAssignment($networkAuthId, $networkId, $networkType);
516
- if ($networkAuthAssignment['result'] !== false) {
517
- $userSelect = $networkAuthAssignment['userSelect'];
518
- $assignList = $networkAuthAssignment['assignList'];
519
-
520
- echo json_encode(array('result' => true, 'userSelect' => $userSelect, 'assignList' => $assignList));
521
- wp_die();
522
- }
523
- }
524
- }
525
- echo json_encode(array('result' => false));
526
- wp_die();
527
- }
528
-
529
- public function getEditTemplateForm() {
530
- if (isset($_GET['networkId']) && (int) $_GET['networkId'] > 0) {
531
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
532
- $networkItem = new B2S_Network_Item(false);
533
-
534
- $content = $networkItem->getEditTemplateForm($_GET['networkId']);
535
-
536
- echo json_encode(array('result' => true, 'content' => $content));
537
- wp_die();
538
- }
539
- echo json_encode(array('result' => false));
540
- wp_die();
541
- }
542
-
543
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ajax_Get {
4
+
5
+ static private $instance = null;
6
+
7
+ static public function getInstance() {
8
+ if (null === self::$instance) {
9
+ self::$instance = new self;
10
+ }
11
+ return self::$instance;
12
+ }
13
+
14
+ public function __construct() {
15
+ add_action('wp_ajax_b2s_ship_item', array($this, 'getShipItem'));
16
+ add_action('wp_ajax_b2s_sort_data', array($this, 'getSortData'));
17
+ add_action('wp_ajax_b2s_get_sched_posts_by_user_auth', array($this, 'getSchedPostsByUserAuth'));
18
+ add_action('wp_ajax_b2s_get_network_board_and_group', array($this, 'getNetworkBoardAndGroup'));
19
+ add_action('wp_ajax_b2s_publish_post_data', array($this, 'getPublishPostData'));
20
+ add_action('wp_ajax_b2s_sched_post_data', array($this, 'getSchedPostData'));
21
+ add_action('wp_ajax_b2s_approve_post_data', array($this, 'getApprovePostData'));
22
+ add_action('wp_ajax_b2s_ship_navbar_item', array($this, 'getNavbarItem'));
23
+ add_action('wp_ajax_b2s_post_meta_box', array($this, 'getPostMetaBox'));
24
+ add_action('wp_ajax_b2s_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'));
30
+ add_action('wp_ajax_b2s_get_calendar_events', array($this, 'getCalendarEvents'));
31
+ add_action('wp_ajax_b2s_get_post_edit_modal', array($this, 'getPostEditModal'));
32
+ add_action('wp_ajax_b2s_get_calendar_filter_network_auth', array($this, 'getCalendarFilterNetworkAuth'));
33
+ add_action('wp_ajax_b2s_get_image_modal', array($this, 'getImageModal'));
34
+ add_action('wp_ajax_b2s_get_multi_widget_content', array($this, 'getMultiWidgetContent'));
35
+ add_action('wp_ajax_b2s_get_stats', array($this, 'getStats'));
36
+ add_action('wp_ajax_b2s_get_blog_post_status', array($this, 'getBlogPostStatus'));
37
+ add_action('wp_ajax_b2s_support_systemrequirements', array($this, 'b2sSupportSystemRequirements'));
38
+ add_action('wp_ajax_b2s_search_user', array($this, 'searchUser'));
39
+ add_action('wp_ajax_b2s_get_select_mandant_user', array($this, 'getSelectMandantUser'));
40
+ add_action('wp_ajax_b2s_get_edit_template', array($this, 'getEditTemplateForm'));
41
+ add_action('wp_ajax_b2s_check_draft_exists', array($this, 'checkDraftExists'));
42
+ }
43
+
44
+ public function getBlogPostStatus() {
45
+ $status = ($_GET['post_id'] > 0) ? get_post_status($_GET['post_id']) : '';
46
+ echo json_encode($status);
47
+ wp_die();
48
+ }
49
+
50
+ public function scrapeUrl() {
51
+ if (isset($_POST['url']) && !empty($_POST['url'])) {
52
+ $data = B2S_Util::scrapeUrl($_POST['url']);
53
+ $scrapeError = ($data !== false) ? false : true;
54
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/View.php');
55
+ $curation = new B2S_Curation_View();
56
+ $preview = $curation->getCurationPreviewHtml($_POST['url'], $data);
57
+ if (!empty($preview)) {
58
+ if (isset($_POST['loadSettings']) && filter_var($_POST['loadSettings'], FILTER_VALIDATE_BOOLEAN)) {
59
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getProfileUserAuth', 'token' => B2S_PLUGIN_TOKEN)));
60
+ if (isset($result->result) && (int) $result->result == 1 && isset($result->data) && !empty($result->data) && isset($result->data->mandant) && isset($result->data->auth) && !empty($result->data->mandant) && !empty($result->data->auth)) {
61
+ echo json_encode(array('result' => true, 'preview' => $preview, 'scrapeError' => $scrapeError, 'settings' => $curation->getShippingDetails($result->data->mandant, $result->data->auth)));
62
+ wp_die();
63
+ }
64
+ echo json_encode(array('result' => false, 'preview' => $preview, 'scrapeError' => $scrapeError, 'error' => 'NO_AUTH'));
65
+ wp_die();
66
+ } else {
67
+ echo json_encode(array('result' => true, 'preview' => $preview, 'scrapeError' => $scrapeError));
68
+ wp_die();
69
+ }
70
+ }
71
+ }
72
+ echo json_encode(array('result' => false, 'preview' => '', 'scrapeError' => false, 'error' => 'NO_PREVIEW'));
73
+ wp_die();
74
+ }
75
+
76
+ public function getSortData() {
77
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
78
+ require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
79
+ /* Sort */
80
+ $b2sType = isset($_POST['b2sType']) ? trim($_POST['b2sType']) : "";
81
+ $b2sPagination = (int) isset($_POST['b2sPagination']) ? $_POST['b2sPagination'] : 1;
82
+ $b2sShowPagination = !isset($_POST['b2sShowPagination']) || $_POST['b2sShowPagination'] == 1;
83
+ $b2sSortPostTitle = isset($_POST['b2sSortPostTitle']) ? trim(strip_tags($_POST['b2sSortPostTitle'])) : "";
84
+ $b2sSortPostAuthor = isset($_POST['b2sSortPostAuthor']) ? trim($_POST['b2sSortPostAuthor']) : "";
85
+ $b2sSortPostSchedDate = isset($_POST['b2sSortPostSchedDate']) ? (in_array(trim($_POST['b2sSortPostSchedDate']), array('desc', 'asc')) ? trim($_POST['b2sSortPostSchedDate']) : "") : "";
86
+ $b2sSortPostPublishDate = isset($_POST['b2sSortPostPublishDate']) ? (in_array(trim($_POST['b2sSortPostPublishDate']), array('desc', 'asc')) ? trim($_POST['b2sSortPostPublishDate']) : "") : "";
87
+ $b2sSortPostStatus = isset($_POST['b2sSortPostStatus']) ? trim($_POST['b2sSortPostStatus']) : "";
88
+ $b2sSortPostShareStatus = isset($_POST['b2sSortPostShareStatus']) ? trim($_POST['b2sSortPostShareStatus']) : "";
89
+ $b2sShowByDate = isset($_POST['b2sShowByDate']) ? (preg_match("#^[0-9\-.\]]+$#", trim($_POST['b2sShowByDate'])) ? trim($_POST['b2sShowByDate']) : "") : ""; //YYYY-mm-dd
90
+ $b2sShowByNetwork = isset($_POST['b2sShowByNetwork']) ? (int) $_POST['b2sShowByNetwork'] : 0;
91
+ $b2sUserAuthId = isset($_POST['b2sUserAuthId']) ? (int) $_POST['b2sUserAuthId'] : 0;
92
+ $b2sPostBlogId = isset($_POST['b2sPostBlogId']) ? (int) $_POST['b2sPostBlogId'] : 0;
93
+ $b2sSortPostCat = isset($_POST['b2sSortPostCat']) ? trim($_POST['b2sSortPostCat']) : "";
94
+ $b2sSortPostType = isset($_POST['b2sSortPostType']) ? trim($_POST['b2sSortPostType']) : "";
95
+ $b2sSelectSchedDate = isset($_POST['b2sSchedDate']) ? (preg_match("#^[0-9\-.\]]+$#", trim($_POST['b2sSchedDate'])) ? trim($_POST['b2sSchedDate']) : "") : "";
96
+ $b2sUserLang = isset($_POST['b2sUserLang']) ? trim(strip_tags($_POST['b2sUserLang'])) : strtolower(substr(B2S_LANGUAGE, 0, 2));
97
+ $b2sResultsPerPage = isset($_POST['b2sPostsPerPage']) && intval($_POST['b2sPostsPerPage']) > 0 ? intval($_POST['b2sPostsPerPage']) : B2S_PLUGIN_POSTPERPAGE;
98
+ if (!empty($b2sType) && in_array($b2sType, array('all', 'sched', 'publish', 'notice', 'approve', 'draft', 'draft-post'))) {
99
+ $postItem = new B2S_Post_Item($b2sType, $b2sSortPostTitle, $b2sSortPostAuthor, $b2sSortPostStatus, $b2sSortPostShareStatus, $b2sSortPostPublishDate, $b2sSortPostSchedDate, $b2sShowByDate, $b2sShowByNetwork, $b2sUserAuthId, $b2sPostBlogId, $b2sPagination, $b2sSortPostCat, $b2sSortPostType, $b2sUserLang, $b2sResultsPerPage);
100
+ $result = array('result' => true, 'content' => $postItem->getItemHtml($b2sSelectSchedDate), 'schedDates' => json_encode($postItem->getCalendarSchedDate()));
101
+ if ($b2sShowPagination) {
102
+ $result['pagination'] = $postItem->getPaginationHtml();
103
+ }
104
+ echo json_encode($result);
105
+ wp_die();
106
+ }
107
+ echo json_encode(array('result' => false, 'content' => '', 'schedDates' => 0, 'pagination' => ''));
108
+ wp_die();
109
+ }
110
+
111
+ public function getNetworkBoardAndGroup() {
112
+ if (isset($_POST['networkId']) && !empty($_POST['networkId']) && isset($_POST['networkAuthId']) && !empty($_POST['networkAuthId'])) {
113
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getNetworkBoardAndGroup', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => $_POST['networkAuthId'], 'networkId' => $_POST['networkId'], 'lang' => substr(B2S_LANGUAGE, 0, 2))));
114
+ if (is_object($result) && !empty($result) && isset($result->data) && !empty($result->data) && isset($result->result) && (int) $result->result == 1) {
115
+ require_once B2S_PLUGIN_DIR . 'includes/Form.php';
116
+ echo json_encode(array('result' => true, 'content' => B2S_Form::getNetworkBoardAndGroupHtml($result->data, $_POST['networkId'])));
117
+ wp_die();
118
+ }
119
+ }
120
+ echo json_encode(array('result' => false, 'content' => ''));
121
+ wp_die();
122
+ }
123
+
124
+ public function getFaqEntries() {
125
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getFaqEntries', 'lang' => substr(B2S_LANGUAGE, 0, 2), 'token' => B2S_PLUGIN_TOKEN)));
126
+ if (isset($result->result) && isset($result->content) && !empty($result->content)) {
127
+ echo json_encode(array('result' => true, 'content' => B2S_Notice::getFaqEntriesHtml($result->content)));
128
+ wp_die();
129
+ }
130
+ echo json_encode(array('result' => false, 'content' => ''));
131
+ wp_die();
132
+ }
133
+
134
+ public function getPostMetaBox() {
135
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getProfileUserAuth', 'token' => B2S_PLUGIN_TOKEN)));
136
+ if (isset($result->result) && (int) $result->result == 1 && isset($result->data) && !empty($result->data) && isset($result->data->mandant) && isset($result->data->auth) && !empty($result->data->mandant)) {
137
+ if (!empty($result->data->auth)) {
138
+ $postBox = new B2S_PostBox();
139
+ echo json_encode(array('result' => true, 'content' => $postBox->getPostBoxAutoHtml($result->data->mandant, $result->data->auth)));
140
+ wp_die();
141
+ } else {
142
+ echo json_encode(array('result' => false, 'content' => 'no_auth'));
143
+ wp_die();
144
+ }
145
+ }
146
+ echo json_encode(array('result' => false, 'content' => ''));
147
+ wp_die();
148
+ }
149
+
150
+ public function getShipItemFullText() {
151
+ if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
152
+ $userLang = isset($_POST['userLang']) ? trim($_POST['userLang']) : strtolower(substr(B2S_LANGUAGE, 0, 2));
153
+ $data = get_post((int) $_POST['postId']);
154
+ if (isset($data->post_content)) {
155
+ $postUrl = (get_permalink($data->ID) !== false) ? get_permalink($data->ID) : $data->guid;
156
+ $content = trim(B2S_Util::prepareContent($data->ID, $data->post_content, $postUrl, '', false, $userLang));
157
+ $networkId = isset($_POST['networkId']) ? (int) $_POST['networkId'] : 0;
158
+ echo json_encode(array('result' => true, 'text' => trim(strip_tags($content)), 'networkAuthId' => (int) $_POST['networkAuthId'], 'networkId' => $networkId));
159
+ wp_die();
160
+ }
161
+ }
162
+ echo json_encode(array('result' => false));
163
+ wp_die();
164
+ }
165
+
166
+ public function getShipItem() {
167
+ if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
168
+ //TOS XING Group
169
+ if ((int) $_POST['networkId'] == 19 && isset($_POST['networkTosGroupId']) && !empty($_POST['networkTosGroupId'])) {
170
+ $options = new B2S_Options(0, 'B2S_PLUGIN_TOS_XING_GROUP_CROSSPOSTING');
171
+ if ($options->existsValueByKey($_POST['postId'], $_POST['networkTosGroupId'])) {
172
+ echo json_encode(array('result' => false, 'reason' => 'tos_xing_group_exists', 'networkAuthId' => (int) $_POST['networkAuthId']));
173
+ wp_die();
174
+ }
175
+ }
176
+
177
+ $userLang = isset($_POST['userLang']) ? trim($_POST['userLang']) : strtolower(substr(B2S_LANGUAGE, 0, 2));
178
+ $relayCount = isset($_POST['relayCount']) ? (int) $_POST['relayCount'] : 0;
179
+ require_once B2S_PLUGIN_DIR . 'includes/B2S/Ship/Item.php';
180
+ $itemData = array('networkAuthId' => (int) $_POST['networkAuthId'],
181
+ 'networkId' => (int) $_POST['networkId'],
182
+ 'networkKind' => (int) $_POST['networkKind'],
183
+ 'networkTosGroupId' => ((isset($_POST['networkTosGroupId']) && !empty($_POST['networkTosGroupId'])) ? trim($_POST['networkTosGroupId']) : ''),
184
+ 'instantSharing' => (isset($_POST['instantSharing']) ? (int) $_POST['instantSharing'] : 0),
185
+ 'network_display_name' => strip_tags(stripslashes($_POST['networkDisplayName'])),
186
+ 'networkType' => (int) $_POST['networkType']);
187
+ $selSchedDate = (isset($_POST['selSchedDate']) && !empty($_POST['selSchedDate'])) ? $_POST['selSchedDate'] : ""; //routing from calendar
188
+ $b2sPostType = (isset($_POST['b2sPostType']) && $_POST['b2sPostType'] == 'ex') ? 'ex' : ""; //Content Curation
189
+
190
+ $b2sDraftData = array();
191
+ if (isset($_POST['b2sDraftData']) && !empty($_POST['b2sDraftData'])) {
192
+ $drafts = unserialize(urldecode($_POST['b2sDraftData']));
193
+ if (isset($drafts['b2s']) && !empty($drafts['b2s']) && array_key_exists($_POST['networkAuthId'], $drafts['b2s'])) {
194
+ $b2sDraftData = $drafts['b2s'][$_POST['networkAuthId']];
195
+ if (!empty($b2sDraftData) && is_array($b2sDraftData)) {
196
+ foreach ($b2sDraftData as $key => $value) {
197
+ if (!is_array($value)) {
198
+ $b2sDraftData[$key] = stripslashes($value);
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ $item = new B2S_Ship_Item((int) $_POST['postId'], $userLang, $selSchedDate, $b2sPostType, $relayCount);
206
+ echo json_encode(array('result' => true, 'networkAuthId' => (int) $_POST['networkAuthId'], 'networkType' => (int) $_POST['networkType'], 'networkId' => (int) $_POST['networkId'], 'content' => $item->getItemHtml((object) $itemData, true, $b2sDraftData), 'draft' => !empty($b2sDraftData), 'draftActions' => $b2sDraftData));
207
+ } else {
208
+ echo json_encode(array('result' => false));
209
+ }
210
+ wp_die();
211
+ }
212
+
213
+ public function getPublishPostData() {
214
+ if ((int) $_POST['postId']) {
215
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
216
+ require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
217
+ $postData = new B2S_Post_Item();
218
+ $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
219
+ $type = (isset($_POST['type']) && in_array($_POST['type'], array('publish', 'notice'))) ? $_POST['type'] : 'publish';
220
+ $result = $postData->getPublishPostDataHtml((int) $_POST['postId'], $type, $showByDate);
221
+ if ($result !== false) {
222
+ echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
223
+ wp_die();
224
+ }
225
+ }
226
+ echo json_encode(array('result' => false));
227
+ wp_die();
228
+ }
229
+
230
+ public function getApprovePostData() {
231
+ if ((int) $_POST['postId']) {
232
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
233
+ require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
234
+ $postData = new B2S_Post_Item();
235
+ $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
236
+ $result = $postData->getApprovePostDataHtml((int) $_POST['postId'], $showByDate);
237
+ if ($result !== false) {
238
+ echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
239
+ wp_die();
240
+ }
241
+ }
242
+ echo json_encode(array('result' => false));
243
+ wp_die();
244
+ }
245
+
246
+ public function getSchedPostsByUserAuth() {
247
+ if ((int) $_POST['networkAuthId']) {
248
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
249
+ $networkData = new B2S_Network_Item(false);
250
+ global $wpdb;
251
+ $blogUserTokenResult = $wpdb->get_results("SELECT token FROM `b2s_user`");
252
+ $blogUserToken = array();
253
+ foreach ($blogUserTokenResult as $k => $row) {
254
+ array_push($blogUserToken, $row->token);
255
+ }
256
+ $data = array('action' => 'getTeamAssignUserAuth', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $_POST['networkAuthId'], 'blogUser' => $blogUserToken);
257
+ $networkAuthAssignment = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30), true);
258
+ $count = $networkData->getCountSchedPostsByUserAuth((int) $_POST['networkAuthId']);
259
+ if ($networkAuthAssignment['result'] == true) {
260
+ $assignCount = 0;
261
+ $assignList = array();
262
+ foreach ($networkAuthAssignment['assignList'] as $k => $v) {
263
+ $assignList[$v['assign_blog_user_id']] = (int) $v['assign_network_auth_id'];
264
+ $authCount = $networkData->getCountSchedPostsByUserAuth((int) $v['assign_network_auth_id']);
265
+ if ($authCount !== false) {
266
+ $assignCount += $authCount;
267
+ }
268
+ }
269
+ echo json_encode(array('result' => true, 'count' => ($count !== false) ? $count : 0, 'assignCount' => $assignCount, 'assignListCount' => count($networkAuthAssignment['assignList']), 'assignList' => serialize($assignList)));
270
+ wp_die();
271
+ } else {
272
+ if ($count !== false) {
273
+ echo json_encode(array('result' => true, 'count' => $count));
274
+ wp_die();
275
+ }
276
+ }
277
+ }
278
+ echo json_encode(array('result' => false, 'count' => 0));
279
+ wp_die();
280
+ }
281
+
282
+ public function getSchedPostData() {
283
+ if ((int) $_POST['postId']) {
284
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Item.php');
285
+ require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
286
+ $postData = new B2S_Post_Item();
287
+ $showByDate = isset($_POST['showByDate']) ? trim($_POST['showByDate']) : '';
288
+ $showByNetwork = isset($_POST['showByNetwork']) ? trim($_POST['showByNetwork']) : '';
289
+ $userAuthId = isset($_POST['userAuthId']) ? (int) $_POST['userAuthId'] : 0;
290
+ $result = $postData->getSchedPostDataHtml((int) $_POST['postId'], $showByDate, $showByNetwork, $userAuthId);
291
+ if ($result !== false) {
292
+ echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
293
+ wp_die();
294
+ }
295
+ }
296
+ echo json_encode(array('result' => false));
297
+ wp_die();
298
+ }
299
+
300
+ public function getNavbarItem() {
301
+ if (isset($_POST['networkId']) && isset($_POST['networkAuthId']) && isset($_POST['networkType']) && isset($_POST['displayName']) && isset($_POST['mandandId'])) {
302
+ require_once (B2S_PLUGIN_DIR . '/includes/B2S/Ship/Navbar.php');
303
+ global $wpdb;
304
+ $mandantCount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(mandant_id)FROM b2s_user_network_settings WHERE mandant_id =%d AND blog_user_id=%d ", $_POST['mandandId'], B2S_PLUGIN_BLOG_USER_ID));
305
+ if ($mandantCount > 0) {
306
+ $wpdb->insert('b2s_user_network_settings', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'mandant_id' => $_POST['mandandId'], 'network_auth_id' => $_POST['networkAuthId']), array('%d', '%d', '%d'));
307
+ }
308
+ $data = array(
309
+ 'networkId' => isset($_POST['networkId']) ? (int) $_POST['networkId'] : 0,
310
+ 'networkAuthId' => isset($_POST['networkAuthId']) ? (int) $_POST['networkAuthId'] : 0,
311
+ 'networkType' => isset($_POST['networkType']) ? (int) $_POST['networkType'] : 0,
312
+ 'networkUserName' => isset($_POST['displayName']) ? strip_tags($_POST['displayName']) : '',
313
+ 'mandantId' => isset($_POST['mandandId']) ? (int) $_POST['mandandId'] : 0,
314
+ 'networkKind' => isset($_POST['networkKind']) ? (int) $_POST['networkKind'] : 0,
315
+ 'networkTosGroupId' => isset($_POST['networkTosGroupId']) ? (int) $_POST['networkTosGroupId'] : '',
316
+ 'expiredDate' => date('Y-m-d', strtotime('+3 days')));
317
+
318
+ $navbar = new B2S_Ship_Navbar();
319
+ echo json_encode(array('result' => true, 'networkAuthId' => (int) $_POST['networkAuthId'], 'content' => $navbar->getItemHtml((object) $data)));
320
+ wp_die();
321
+ }
322
+ echo json_encode(array('result' => false));
323
+ wp_die();
324
+ }
325
+
326
+ public function getSettingsSchedTimeDefault() {
327
+ $userTimes = B2S_Tools::getRandomBestTimeSettings();
328
+ if (!empty($userTimes) && is_array($userTimes)) {
329
+ echo json_encode(array('result' => true, 'times' => $userTimes));
330
+ wp_die();
331
+ }
332
+ echo json_encode(array('result' => false));
333
+ wp_die();
334
+ }
335
+
336
+ //NEW V5.1.0
337
+ public function getUserTimeSettings() {
338
+ $lang = substr(B2S_LANGUAGE, 0, 2);
339
+ $options = new B2S_Options(get_current_user_id());
340
+ $userSchedData = $options->_getOption('auth_sched_time');
341
+ if (isset($userSchedData['time'])) {
342
+ if (is_array($userSchedData) && isset($userSchedData['delay_day']) && isset($userSchedData['time']) && is_array($userSchedData['time'])) {
343
+ foreach ($userSchedData['time'] as $k => $v) {
344
+ $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
345
+ $userSchedData['time'][$k] = date($slug, strtotime(date('Y-m-d ' . $v . ':00')));
346
+ }
347
+ echo json_encode(array('result' => true, 'type' => 'new', 'delay_day' => $userSchedData['delay_day'], 'times' => $userSchedData['time']));
348
+ wp_die();
349
+ }
350
+ //load old setttings >5.1.0
351
+ } else {
352
+ global $wpdb;
353
+ //if exists
354
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_post_sched_settings'") == 'b2s_post_sched_settings') {
355
+ $userTimes = array();
356
+ $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));
357
+ if (!empty($saveSchedData) && is_array($saveSchedData)) {
358
+ foreach ($saveSchedData as $k => $v) {
359
+ $slug = ($lang == 'en') ? 'h:i A' : 'H:i';
360
+ $userTimes[$v->network_id][$v->network_type] = date($slug, strtotime(date('Y-m-d ' . $v->sched_time . ':00')));
361
+ }
362
+ if (!empty($userTimes)) {
363
+ echo json_encode(array('result' => true, 'type' => 'old', 'times' => $userTimes));
364
+ wp_die();
365
+ }
366
+ }
367
+ }
368
+ }
369
+ echo json_encode(array('result' => false));
370
+ wp_die();
371
+ }
372
+
373
+ public function getShipItemReloadUrl() {
374
+ if (isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['url']) && !empty($_POST['url'])) {
375
+ if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['defaultUrl']) && $_POST['defaultUrl'] == $_POST['url']) {
376
+ $postData = get_post($_POST['postId']);
377
+ if ($postData->post_status != 'publish') {
378
+ $postUrl = (get_permalink($postData->ID) !== false ? get_permalink($postData->ID) : $postData->guid);
379
+ $metaInfo = array('title' => B2S_Util::getExcerpt(B2S_Util::remove4byte($postData->post_title), 50) . ' - ' . get_option('blogname'), 'description' => B2S_Util::getExcerpt(B2S_Util::prepareContent($postData->ID, $postData->post_content, $postUrl, false, false), 150));
380
+ } else {
381
+ $metaInfo = B2S_Util::getMetaTags((int) $_POST['postId'], strip_tags($_POST['url']), (int) $_POST['networkId']);
382
+ }
383
+ } else {
384
+ $metaInfo = B2S_Util::getMetaTags(0, strip_tags($_POST['url']), (int) $_POST['networkId']);
385
+ }
386
+ echo json_encode(array('result' => true, 'networkId' => (int) $_POST['networkId'], 'networkAuthId' => $_POST['networkAuthId'], 'title' => isset($metaInfo['title']) ? $metaInfo['title'] : '', 'description' => isset($metaInfo['description']) ? $metaInfo['description'] : '', 'image' => isset($metaInfo['image']) ? $metaInfo['image'] : ''));
387
+ wp_die();
388
+ }
389
+ echo json_encode(array('result' => false));
390
+ wp_die();
391
+ }
392
+
393
+ public function getCalendarEvents() {
394
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Filter.php');
395
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Image.php');
396
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Settings/Item.php');
397
+ require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
398
+
399
+ //Filter Network
400
+ $network_id = (isset($_GET['filter_network']) && (int) $_GET['filter_network'] >= 1) ? (int) $_GET['filter_network'] : 0; // 0=all
401
+ //Filter Network Details
402
+ $network_details_id = (isset($_GET['filter_network_auth']) && (int) $_GET['filter_network_auth'] >= 1) ? (int) $_GET['filter_network_auth'] : 0; // 0=all
403
+ //Filter Status
404
+ $status = (isset($_GET['filter_status']) && (int) $_GET['filter_status'] >= 0) ? (int) $_GET['filter_status'] : 0; // 0=all,1=publish, 2=scheduled
405
+
406
+ if (isset($_GET['start'])) {
407
+ $calendar = B2S_Calendar_Filter::getByTimespam($_GET['start'] . " 00:00:00", $_GET['end'] . " 23:59:59", $network_id, $network_details_id, $status);
408
+ } else {
409
+ $calendar = B2S_Calendar_Filter::getAll($network_id, $network_details_id);
410
+ }
411
+ echo json_encode($calendar->asCalendarArray());
412
+ wp_die();
413
+ }
414
+
415
+ public function getCalendarFilterNetworkAuth() {
416
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Filter.php');
417
+ $network_id = (isset($_POST['network_id']) && (int) $_POST['network_id'] >= 1) ? (int) $_POST['network_id'] : 0; // 0=all
418
+ if ($network_id != 0) {
419
+ $result = B2S_Calendar_Filter::getFilterNetworkAuthHtml($network_id);
420
+ if ($result !== false) {
421
+ echo json_encode(array('result' => true, 'content' => $result));
422
+ wp_die();
423
+ }
424
+ }
425
+ echo json_encode(array('result' => false));
426
+ wp_die();
427
+ }
428
+
429
+ public function getPostEditModal() {
430
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Filter.php');
431
+ if (isset($_POST['id']) && (int) $_POST['id'] > 0) {
432
+ $item = B2S_Calendar_Filter::getById((int) $_POST['id']);
433
+ if ($item != null) {
434
+ $lock_user_id = get_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $_POST['id']);
435
+ if (!$lock_user_id) {
436
+ update_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $_POST['id'], get_current_user_id(), false);
437
+ $options = new B2S_Options(get_current_user_id());
438
+ $block_old = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
439
+
440
+ if ($block_old) {
441
+ delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $block_old);
442
+ }
443
+ $options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", $_POST['id']);
444
+ }
445
+ if ($lock_user_id) {
446
+ $lock_user = get_userdata($lock_user_id);
447
+ }
448
+ include (B2S_PLUGIN_DIR . 'views/b2s/partials/post-edit-modal.php');
449
+ wp_die();
450
+ }
451
+ }
452
+ echo "0";
453
+ wp_die();
454
+ }
455
+
456
+ public function getImageModal() {
457
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Image.php');
458
+ if (isset($_POST['id']) && (int) $_POST['id'] > 0) {
459
+ $postData = get_post((int) $_POST['id']);
460
+ if (isset($postData->ID)) {
461
+ $postUrl = (get_permalink($postData->ID) !== false ? get_permalink($postData->ID) : $postData->guid);
462
+ include (B2S_PLUGIN_DIR . 'views/b2s/partials/calendar-image-modal.php');
463
+ wp_die();
464
+ }
465
+ }
466
+ echo "0";
467
+ wp_die();
468
+ }
469
+
470
+ public function getMultiWidgetContent() {
471
+ $option = get_option("B2S_MULTI_WIDGET");
472
+ if ($option !== false) {
473
+ if (is_array($option) && isset($option['timestamp']) && isset($option['content']) && !empty($option['content']) && $option['timestamp'] > date('Y-m-d H:i:s', strtotime("-1 hours"))) {
474
+ die($option['content']);
475
+ }
476
+ }
477
+ $content = B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getNews', 'version' => B2S_PLUGIN_VERSION, 'lang' => strtolower(substr(get_locale(), 0, 2)), 'token' => B2S_PLUGIN_TOKEN));
478
+ update_option("B2S_MULTI_WIDGET", array("timestamp" => date("Y-m-d H:i:s"), "content" => $content), false);
479
+ echo $content;
480
+ wp_die();
481
+ }
482
+
483
+ public function getStats() {
484
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Stats.php');
485
+ $stats = new B2S_Stats();
486
+ if (isset($_GET['from']) && !empty($_GET['from'])) {
487
+ $stats->set_from($_GET['from']);
488
+ }
489
+ echo json_encode($stats->get_result());
490
+ wp_die();
491
+ }
492
+
493
+ public function b2sSupportSystemRequirements() {
494
+ if (!current_user_can('administrator')) {
495
+ echo json_encode(array('result' => false, 'error' => 'admin'));
496
+ wp_die();
497
+ }
498
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Support/Check/System.php');
499
+ $support = new B2S_Support_Check_System();
500
+ $htmlData = $support->htmlData();
501
+ $blogData = $support->blogData();
502
+ if (empty($htmlData) || empty($blogData)) {
503
+ $result = array('result' => false);
504
+ } else {
505
+ $result = array('result' => true, 'htmlData' => $htmlData, "blogData" => $blogData);
506
+ }
507
+ echo json_encode($result);
508
+ wp_die();
509
+ }
510
+
511
+ public function searchUser() {
512
+ if (isset($_GET['search_user']) && !empty($_GET['search_user'])) {
513
+ $options = B2S_Tools::searchUser($_GET['search_user']);
514
+ echo json_encode(array('result' => true, 'options' => $options));
515
+ wp_die();
516
+ }
517
+ echo json_encode(array('result' => false));
518
+ wp_die();
519
+ }
520
+
521
+ public function getSelectMandantUser() {
522
+ if (isset($_GET['owner']) && (int) $_GET['owner'] > 0) {
523
+ $owner = stripslashes(get_user_by('id', $_GET['owner'])->display_name);
524
+ $owner = (empty($owner) || $owner == false) ? __("Unknown username", "blog2social") : $owner;
525
+ echo json_encode(array('result' => true, 'ownerName' => $owner));
526
+ wp_die();
527
+ } else {
528
+ $networkAuthId = (isset($_GET['networkAuthId']) && (int) $_GET['networkAuthId'] > 0) ? $_GET['networkAuthId'] : 0;
529
+ $networkId = (isset($_GET['networkId']) && (int) $_GET['networkId'] > 0) ? $_GET['networkId'] : 0;
530
+ $networkType = (isset($_GET['networkType']) && (int) $_GET['networkType'] >= 0) ? $_GET['networkType'] : 0;
531
+ if ($networkAuthId > 0 && $networkId > 0) {
532
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
533
+ $networkItem = new B2S_Network_Item();
534
+ $networkAuthAssignment = $networkItem->getNetworkAuthAssignment($networkAuthId, $networkId, $networkType);
535
+ if ($networkAuthAssignment['result'] !== false) {
536
+ $userSelect = $networkAuthAssignment['userSelect'];
537
+ $assignList = $networkAuthAssignment['assignList'];
538
+
539
+ echo json_encode(array('result' => true, 'userSelect' => $userSelect, 'assignList' => $assignList));
540
+ wp_die();
541
+ }
542
+ }
543
+ }
544
+ echo json_encode(array('result' => false));
545
+ wp_die();
546
+ }
547
+
548
+ public function getEditTemplateForm() {
549
+ if (isset($_GET['networkId']) && (int) $_GET['networkId'] > 0) {
550
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
551
+ $networkItem = new B2S_Network_Item(false);
552
+
553
+ $content = $networkItem->getEditTemplateForm($_GET['networkId']);
554
+
555
+ echo json_encode(array('result' => true, 'content' => $content));
556
+ wp_die();
557
+ }
558
+ echo json_encode(array('result' => false));
559
+ wp_die();
560
+ }
561
+
562
+ public function checkDraftExists() {
563
+ if (isset($_GET['postId']) && (int) $_GET['postId'] > 0) {
564
+ global $wpdb;
565
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts_drafts'") == 'b2s_posts_drafts') {
566
+ $sqlCheckDraft = $wpdb->prepare("SELECT `id` FROM `b2s_posts_drafts` WHERE `blog_user_id` = %d AND `post_id` = %d", B2S_PLUGIN_BLOG_USER_ID, $_GET['postId']);
567
+ $draftEntry = $wpdb->get_var($sqlCheckDraft);
568
+ if ($draftEntry !== NULL && (int) $draftEntry > 0) {
569
+ echo json_encode(array('result' => true));
570
+ wp_die();
571
+ }
572
+ }
573
+ }
574
+ echo json_encode(array('result' => false));
575
+ wp_die();
576
+ }
577
+
578
+ }
includes/Ajax/Post.php CHANGED
@@ -24,6 +24,7 @@ class Ajax_Post {
24
  add_action('wp_ajax_b2s_delete_user_sched_post', array($this, 'deleteUserSchedPost'));
25
  add_action('wp_ajax_b2s_delete_user_publish_post', array($this, 'deleteUserPublishPost'));
26
  add_action('wp_ajax_b2s_delete_user_approve_post', array($this, 'deleteUserApprovePost'));
 
27
  add_action('wp_ajax_b2s_user_network_settings', array($this, 'saveUserNetworkSettings'));
28
  add_action('wp_ajax_b2s_save_social_meta_tags', array($this, 'saveSocialMetaTags'));
29
  add_action('wp_ajax_b2s_reset_social_meta_tags', array($this, 'resetSocialMetaTags'));
@@ -52,6 +53,8 @@ class Ajax_Post {
52
  add_action("wp_ajax_b2s_assign_network_user_auth", array($this, 'assignNetworkUserAuth'));
53
  add_action("wp_ajax_b2s_save_post_template", array($this, 'savePostTemplate'));
54
  add_action("wp_ajax_b2s_load_default_post_template", array($this, 'loadDefaultPostTemplate'));
 
 
55
  }
56
 
57
  public function curationDraft() {
@@ -228,11 +231,16 @@ class Ajax_Post {
228
  }
229
 
230
  public function curationCustomize() {
 
231
  if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['url']) && !empty($_POST['url'])) {
232
  require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
233
- $data = array('title' => $_POST['title'], 'url' => $_POST['url'], 'content' => (isset($_POST['comment']) ? $_POST['comment'] : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
234
  $curation = new B2S_Curation_Save($data);
235
- $postId = $curation->insertContent();
 
 
 
 
236
  if ($postId !== false) {
237
  $redirect_url = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=blog2social-ship&b2sPostType=ex&postId=' . $postId;
238
  if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date'])) {
@@ -718,7 +726,7 @@ class Ajax_Post {
718
  }
719
 
720
  public function deleteUserAuth() {
721
- $assignList=array();
722
  require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Tools.php');
723
  if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType'])) {
724
  global $wpdb;
@@ -914,6 +922,18 @@ class Ajax_Post {
914
  wp_die();
915
  }
916
 
 
 
 
 
 
 
 
 
 
 
 
 
917
  public function sendTrailFeedback() {
918
  require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
919
  if (isset($_POST['feedback']) && !empty($_POST['feedback'])) {
@@ -1369,24 +1389,24 @@ class Ajax_Post {
1369
  echo json_encode(array('result' => false, 'error_reason' => 'default'));
1370
  wp_die();
1371
  }
1372
-
1373
  public function savePostTemplate() {
1374
- if(isset($_POST['template_data']) && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0){
1375
  require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1376
  $options = new B2S_Options(get_current_user_id());
1377
-
1378
  $post_template_result = false;
1379
  $link_no_cache_option = false;
1380
-
1381
- if(B2S_PLUGIN_USER_VERSION >= 1) {
1382
  $post_template = $options->_getOption("post_template");
1383
 
1384
- if($post_template == false){
1385
  $post_template = array();
1386
  }
1387
 
1388
  $new_template = array();
1389
- foreach ($_POST['template_data'] as $type => $data){
1390
  $limit = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['limit'];
1391
  $range_max = ((int) $limit != 0 && (int) $data['range_max'] > (int) $limit) ? (int) $limit : (int) $data['range_max'];
1392
  $excerpt_range_max = ((int) $limit != 0 && (int) $data['excerpt_range_max'] > (int) $limit) ? (int) $limit : (int) $data['excerpt_range_max'];
@@ -1407,13 +1427,13 @@ class Ajax_Post {
1407
  $post_template[$_POST['networkId']] = $new_template;
1408
  $post_template_result = $options->_setOption("post_template", $post_template);
1409
  }
1410
-
1411
- if((int) $_POST['networkId'] == 1 && isset($_POST['link_no_cache'])){
1412
  $noCache = (int) $_POST['link_no_cache'];
1413
  $link_no_cache_option = $options->_setOption('link_no_cache', $noCache);
1414
  }
1415
 
1416
- if($post_template_result == true || $link_no_cache_option == true){
1417
  echo json_encode(array('result' => true));
1418
  wp_die();
1419
  } else {
@@ -1421,14 +1441,13 @@ class Ajax_Post {
1421
  wp_die();
1422
  }
1423
  }
1424
-
1425
  echo json_encode(array('result' => false));
1426
  wp_die();
1427
-
1428
  }
1429
-
1430
  public function loadDefaultPostTemplate() {
1431
- if(isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType']) && isset(unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']])){
1432
  $default = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']];
1433
  require_once B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php';
1434
  $networkItem = new B2S_Network_Item();
@@ -1440,4 +1459,41 @@ class Ajax_Post {
1440
  wp_die();
1441
  }
1442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1443
  }
24
  add_action('wp_ajax_b2s_delete_user_sched_post', array($this, 'deleteUserSchedPost'));
25
  add_action('wp_ajax_b2s_delete_user_publish_post', array($this, 'deleteUserPublishPost'));
26
  add_action('wp_ajax_b2s_delete_user_approve_post', array($this, 'deleteUserApprovePost'));
27
+ add_action('wp_ajax_b2s_delete_user_cc_draft_post', array($this, 'deleteUserCcDraftPost'));
28
  add_action('wp_ajax_b2s_user_network_settings', array($this, 'saveUserNetworkSettings'));
29
  add_action('wp_ajax_b2s_save_social_meta_tags', array($this, 'saveSocialMetaTags'));
30
  add_action('wp_ajax_b2s_reset_social_meta_tags', array($this, 'resetSocialMetaTags'));
53
  add_action("wp_ajax_b2s_assign_network_user_auth", array($this, 'assignNetworkUserAuth'));
54
  add_action("wp_ajax_b2s_save_post_template", array($this, 'savePostTemplate'));
55
  add_action("wp_ajax_b2s_load_default_post_template", array($this, 'loadDefaultPostTemplate'));
56
+ add_action('wp_ajax_b2s_save_draft_data', array($this, 'saveDraftData'));
57
+ add_action('wp_ajax_b2s_delete_user_draft', array($this, 'deleteDraft'));
58
  }
59
 
60
  public function curationDraft() {
231
  }
232
 
233
  public function curationCustomize() {
234
+
235
  if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['url']) && !empty($_POST['url'])) {
236
  require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
237
+ $data = array('ID' => ((isset($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) ? (int) $_POST['b2s-draft-id'] : 0), 'title' => $_POST['title'], 'url' => $_POST['url'], 'content' => (isset($_POST['comment']) ? $_POST['comment'] : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
238
  $curation = new B2S_Curation_Save($data);
239
+ if (isset($data['ID']) && (int) $data['ID'] > 0) {
240
+ $postId = $curation->updateContent();
241
+ } else {
242
+ $postId = $curation->insertContent();
243
+ }
244
  if ($postId !== false) {
245
  $redirect_url = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=blog2social-ship&b2sPostType=ex&postId=' . $postId;
246
  if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date'])) {
726
  }
727
 
728
  public function deleteUserAuth() {
729
+ $assignList = array();
730
  require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Tools.php');
731
  if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType'])) {
732
  global $wpdb;
922
  wp_die();
923
  }
924
 
925
+ public function deleteUserCcDraftPost() {
926
+ if (isset($_POST['postId']) && !empty($_POST['postId']) && (int) $_POST['postId'] > 0) {
927
+ $res = wp_update_post(array('ID' => (int) $_POST['postId'], 'post_status' => 'trash'), true);
928
+ if ((int) $res > 0) {
929
+ echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId']));
930
+ wp_die();
931
+ }
932
+ }
933
+ echo json_encode(array('result' => false));
934
+ wp_die();
935
+ }
936
+
937
  public function sendTrailFeedback() {
938
  require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
939
  if (isset($_POST['feedback']) && !empty($_POST['feedback'])) {
1389
  echo json_encode(array('result' => false, 'error_reason' => 'default'));
1390
  wp_die();
1391
  }
1392
+
1393
  public function savePostTemplate() {
1394
+ if (isset($_POST['template_data']) && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0) {
1395
  require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1396
  $options = new B2S_Options(get_current_user_id());
1397
+
1398
  $post_template_result = false;
1399
  $link_no_cache_option = false;
1400
+
1401
+ if (B2S_PLUGIN_USER_VERSION >= 1) {
1402
  $post_template = $options->_getOption("post_template");
1403
 
1404
+ if ($post_template == false) {
1405
  $post_template = array();
1406
  }
1407
 
1408
  $new_template = array();
1409
+ foreach ($_POST['template_data'] as $type => $data) {
1410
  $limit = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['limit'];
1411
  $range_max = ((int) $limit != 0 && (int) $data['range_max'] > (int) $limit) ? (int) $limit : (int) $data['range_max'];
1412
  $excerpt_range_max = ((int) $limit != 0 && (int) $data['excerpt_range_max'] > (int) $limit) ? (int) $limit : (int) $data['excerpt_range_max'];
1427
  $post_template[$_POST['networkId']] = $new_template;
1428
  $post_template_result = $options->_setOption("post_template", $post_template);
1429
  }
1430
+
1431
+ if ((int) $_POST['networkId'] == 1 && isset($_POST['link_no_cache'])) {
1432
  $noCache = (int) $_POST['link_no_cache'];
1433
  $link_no_cache_option = $options->_setOption('link_no_cache', $noCache);
1434
  }
1435
 
1436
+ if ($post_template_result == true || $link_no_cache_option == true) {
1437
  echo json_encode(array('result' => true));
1438
  wp_die();
1439
  } else {
1441
  wp_die();
1442
  }
1443
  }
1444
+
1445
  echo json_encode(array('result' => false));
1446
  wp_die();
 
1447
  }
1448
+
1449
  public function loadDefaultPostTemplate() {
1450
+ if (isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType']) && isset(unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']])) {
1451
  $default = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']];
1452
  require_once B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php';
1453
  $networkItem = new B2S_Network_Item();
1459
  wp_die();
1460
  }
1461
 
1462
+ public function saveDraftData() {
1463
+ if (isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1464
+ global $wpdb;
1465
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts_drafts'") == 'b2s_posts_drafts') {
1466
+ $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1467
+ $optionUserTimeZone = $options->_getOption('user_time_zone');
1468
+ $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
1469
+ $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
1470
+ $date = B2S_Util::getCustomLocaleDateTime($userTimeZoneOffset);
1471
+
1472
+ $sqlCheckDraft = $wpdb->prepare("SELECT `id` FROM `b2s_posts_drafts` WHERE `blog_user_id` = %d AND `post_id` = %d", B2S_PLUGIN_BLOG_USER_ID, $_POST['post_id']);
1473
+ $draftEntry = $wpdb->get_var($sqlCheckDraft);
1474
+ if ($draftEntry !== NULL && (int) $draftEntry > 0) {
1475
+ $wpdb->update('b2s_posts_drafts', array('data' => serialize($_POST), 'last_save_date' => $date), array('id' => (int) $draftEntry));
1476
+ } else {
1477
+ $wpdb->insert('b2s_posts_drafts', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => $_POST['post_id'], 'data' => serialize($_POST), 'last_save_date' => $date));
1478
+ }
1479
+
1480
+ echo json_encode(array('result' => true));
1481
+ wp_die();
1482
+ }
1483
+ }
1484
+ echo json_encode(array('result' => false));
1485
+ wp_die();
1486
+ }
1487
+
1488
+ public function deleteDraft() {
1489
+ if (isset($_POST['draftId']) && (int) $_POST['draftId'] > 0) {
1490
+ global $wpdb;
1491
+ $wpdb->delete('b2s_posts_drafts', array('id' => (int) $_POST['draftId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
1492
+ echo json_encode(array('result' => true));
1493
+ wp_die();
1494
+ }
1495
+ echo json_encode(array('result' => false));
1496
+ wp_die();
1497
+ }
1498
+
1499
  }
includes/B2S/AutoPost.php CHANGED
@@ -1,279 +1,277 @@
1
- <?php
2
-
3
- class B2S_AutoPost {
4
-
5
- private $title;
6
- private $contentHtml;
7
- private $postId;
8
- private $content;
9
- private $excerpt;
10
- private $url;
11
- private $imageUrl;
12
- private $keywords;
13
- private $blogPostData = array();
14
- private $myTimeSettings = array();
15
- private $current_user_date;
16
- private $setPreFillText;
17
- private $optionPostFormat;
18
- private $allowHashTag;
19
-
20
- function __construct($postId = 0, $blogPostData = array(), $current_user_date = '0000-00-00 00:00:00', $myTimeSettings = false, $title = '', $content = '', $excerpt = '', $url = '', $imageUrl = '', $keywords = '', $b2sPostLang = 'en', $optionPostFormat = array(), $allowHashTag = true) {
21
- $this->postId = $postId;
22
- $this->blogPostData = $blogPostData;
23
- $this->current_user_date = $current_user_date;
24
- $this->myTimeSettings = $myTimeSettings;
25
- $this->title = $title;
26
- $this->content = B2S_Util::prepareContent($postId, $content, $url, false, true, $b2sPostLang);
27
- $this->excerpt = B2S_Util::prepareContent($postId, $excerpt, $url, false, true, $b2sPostLang);
28
- $this->contentHtml = B2S_Util::prepareContent($postId, $content, $url, '<p><h1><h2><br><i><b><a><img>', true, $b2sPostLang);
29
- $this->url = $url;
30
- $this->imageUrl = $imageUrl;
31
- $this->keywords = $keywords;
32
- $this->optionPostFormat = $optionPostFormat;
33
- $this->allowHashTag = $allowHashTag;
34
- $this->setPreFillText = array(0 => array(6 => 300, 8 => 239, 9 => 200, 10 => 442, 16 => 250, 17 => 442, 18 => 800, 19 => 239), 1 => array(8 => 1200, 10 => 442, 17 => 442, 19 => 239), 2 => array(8 => 239, 10 => 442, 17 => 442, 19 => 239), 20 => 300);
35
- $this->setPreFillTextLimit = array(0 => array(6 => 400, 8 => 400, 9 => 200, 10 => 500, 18 => 1000, 19 => 400, 20 => 400), 1 => array(8 => 1200, 10 => 500, 19 => 400), 2 => array(8 => 400, 10 => 500, 19 => 9000));
36
- }
37
-
38
- public function prepareShareData($networkAuthId = 0, $networkId = 0, $networkType = 0) {
39
- if ((int) $networkId > 0 && (int) $networkAuthId > 0) {
40
- $postData = array('content' => '', 'custom_title' => '', 'tags' => array(), 'network_auth_id' => (int) $networkAuthId);
41
-
42
- if (B2S_PLUGIN_USER_VERSION < 1 || $this->optionPostFormat == false || !isset($this->optionPostFormat[$networkId][$networkType])) {
43
- $this->optionPostFormat = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
44
- }
45
-
46
- //V5.6.1
47
- if (!isset($this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_max'])) {
48
- $defaultSchema = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
49
- $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_max'] = $defaultSchema[$networkId][$networkType]['short_text']['excerpt_range_max'];
50
- }
51
- if (!isset($this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_min'])) {
52
- $defaultSchema = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
53
- $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_min'] = $defaultSchema[$networkId][$networkType]['short_text']['excerpt_range_min'];
54
- }
55
-
56
- //PostFormat
57
- if (in_array($networkId, array(1, 2, 3, 12))) {
58
- //Get: client settings
59
- if (isset($this->optionPostFormat[$networkId][$networkType]['format']) && ((int) $this->optionPostFormat[$networkId][$networkType]['format'] === 0 || (int) $this->optionPostFormat[$networkId][$networkType]['format'] === 1)) {
60
- $postData['post_format'] = (int) $this->optionPostFormat[$networkId][$networkType]['format'];
61
- } else {
62
- //Set: default settings
63
- $defaultPostFormat = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
64
- $postData['post_format'] = isset($defaultPostFormat[$networkId][$networkType]['format']) ? (int) $defaultPostFormat[$networkId][$networkType]['format'] : 0;
65
- }
66
- }
67
- //Special
68
- if (in_array($networkId, array(1, 2, 3, 12))) {
69
- if ($networkId == 12 && $this->imageUrl == false) {
70
- return false;
71
- }
72
- $postData['content'] = $this->optionPostFormat[$networkId][$networkType]['content'];
73
-
74
- $preContent = addcslashes(B2S_Util::getExcerpt($this->content, (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['range_min'], (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['range_max']),"\\$");
75
- $postData['content'] = preg_replace("/\{CONTENT\}/", $preContent, $postData['content']);
76
-
77
- $title = strip_tags($this->title);
78
- $postData['content'] = preg_replace("/\{TITLE\}/", addcslashes($title,"\\$"), $postData['content']);
79
-
80
- $excerpt = (isset($this->excerpt) && !empty($this->excerpt)) ? addcslashes(B2S_Util::getExcerpt($this->excerpt, (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_min'], (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_max']),"\\$") : '';
81
- $postData['content'] = preg_replace("/\{EXCERPT\}/", $excerpt, $postData['content']);
82
-
83
- if (strpos($postData['content'], "{KEYWORDS}") !== false) {
84
- $hashtags = $this->getHashTagsString("");
85
- $postData['content'] = preg_replace("/\{KEYWORDS\}/", addcslashes($hashtags,"\\$"), $postData['content']);
86
- } else if ($this->allowHashTag === false || $this->allowHashTag == 1) {
87
- $add = ($networkId != 2) ? "\n\n" : "";
88
- $hashtags = $this->getHashTagsString($add);
89
- $postData['content'] .= " " . $hashtags;
90
- }
91
- }
92
-
93
- if ($networkId == 4) {
94
- $postData['custom_title'] = strip_tags($this->title);
95
- $postData['content'] = $this->contentHtml;
96
- if ($this->allowHashTag) {
97
- if (is_array($this->keywords) && !empty($this->keywords)) {
98
- foreach ($this->keywords as $tag) {
99
- $postData['tags'][] = str_replace(" ", "", $tag->name);
100
- }
101
- }
102
- }
103
- }
104
-
105
- if ($networkId == 6 || $networkId == 20) {
106
- if ($this->imageUrl !== false) {
107
- $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (int) $this->setPreFillTextLimit[$networkType][$networkId]) : $this->content;
108
- if ($this->allowHashTag) {
109
- $postData['content'] .= $this->getHashTagsString();
110
- }
111
- } else {
112
- return false;
113
- }
114
- }
115
-
116
- if ($networkId == 7) {
117
- if ($this->imageUrl !== false) {
118
- $postData['custom_title'] = strip_tags($this->title);
119
- } else {
120
- return false;
121
- }
122
- }
123
- if ($networkId == 8 && $networkId == 19) {
124
- $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (int) $this->setPreFillTextLimit[$networkType][$networkId]) : $this->content;
125
- if ($networkType != 0) {
126
- $postData['custom_title'] = strip_tags($this->title);
127
- }
128
- }
129
- if ($networkId == 9 || $networkId == 16) {
130
- $postData['custom_title'] = $this->title;
131
- $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (int) $this->setPreFillTextLimit[$networkType][$networkId]) : $this->content;
132
- if ($this->allowHashTag) {
133
- if (is_array($this->keywords) && !empty($this->keywords)) {
134
- foreach ($this->keywords as $tag) {
135
- $postData['tags'][] = str_replace(" ", "", $tag->name);
136
- }
137
- }
138
- }
139
- }
140
-
141
- if ($networkId == 10 || $networkId == 17 || $networkId == 18) {
142
- $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (isset($this->setPreFillTextLimit[$networkType][$networkId]) ? (int) $this->setPreFillTextLimit[$networkType][$networkId] : false)) : $this->content;
143
- if ($this->allowHashTag) {
144
- $postData['content'] .= $this->getHashTagsString();
145
- }
146
- }
147
-
148
- if ($networkId == 11 || $networkId == 14) {
149
- $postData['custom_title'] = strip_tags($this->title);
150
- $postData['content'] = $this->contentHtml;
151
- }
152
-
153
- if ($networkId == 11) {
154
- if ($this->allowHashTag) {
155
- if (is_array($this->keywords) && !empty($this->keywords)) {
156
- foreach ($this->keywords as $tag) {
157
- $postData['tags'][] = str_replace(" ", "", $tag->name);
158
- }
159
- }
160
- }
161
- }
162
-
163
- if ($networkId == 13 || $networkId == 15) {
164
- $postData['content'] = strip_tags($this->title);
165
- }
166
- return $postData;
167
- }
168
- return false;
169
- }
170
-
171
- private function getHashTagsString($add = "\n\n") {
172
- $hashTags = '';
173
- if (is_array($this->keywords) && !empty($this->keywords)) {
174
- foreach ($this->keywords as $tag) {
175
- $hashTags .= ' #' . str_replace(array(" ", "-", '"', "'", "!", "?", ",", ".", ";", ":"), "", $tag->name);
176
- }
177
- }
178
- return (!empty($hashTags) ? (!empty($add) ? $add . $hashTags : $hashTags) : '');
179
- }
180
-
181
- public function saveShareData($shareData = array(), $network_id = 0, $network_type = 0, $network_auth_id = 0, $shareApprove = 0, $network_display_name = '') {
182
-
183
- $sched_type = $this->blogPostData['sched_type'];
184
- $sched_date = $this->blogPostData['sched_date'];
185
- $sched_date_utc = $this->blogPostData['sched_date_utc'];
186
-
187
- //Scheduling post once with user times
188
- if ($sched_type == 2 && $this->myTimeSettings !== false && is_array($this->myTimeSettings) && isset($this->myTimeSettings['times']) && is_array($this->myTimeSettings['times']) && isset($this->myTimeSettings['type'])) {
189
- //V 5.1.0 Seeding
190
- //0=default(best time), 1= special per account (seeding), 2= per network (old)
191
- //Check My Time Setting in Past
192
- //new
193
- if ($this->myTimeSettings['type'] == 1) {
194
- 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])) {
195
- $tempSchedDate = date('Y-m-d', strtotime($sched_date));
196
- $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $this->myTimeSettings['times']['time'][$network_auth_id]));
197
- if ($this->myTimeSettings['times']['delay_day'][$network_auth_id] > 0) {
198
- $sched_date = date('Y-m-d H:i:s', strtotime('+' . $this->myTimeSettings['times']['delay_day'][$network_auth_id] . ' days', strtotime($networkSchedDate)));
199
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
200
- } else {
201
- if ($networkSchedDate >= $sched_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
- //old or default (best time)
213
- } else {
214
- foreach ($this->myTimeSettings['times'] as $k => $v) {
215
- if ($v->network_id == $network_id && $v->network_type == $network_type) {
216
- if (isset($v->sched_time) && !empty($v->sched_time)) {
217
- $tempSchedDate = date('Y-m-d', strtotime($sched_date));
218
- $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $v->sched_time));
219
- if ($networkSchedDate >= $sched_date) {
220
- //Scheduling
221
- $sched_date = $networkSchedDate;
222
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
223
- } else {
224
- //Scheduling on next Day by Past
225
- $sched_date = date('Y-m-d H:i:s', strtotime('+1 days', strtotime($networkSchedDate)));
226
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
227
- }
228
- }
229
- }
230
- }
231
- }
232
- }
233
-
234
- global $wpdb;
235
- $networkDetailsId = 0;
236
- $schedDetailsId = 0;
237
- $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $network_auth_id));
238
- if (isset($networkDetailsIdSelect[0])) {
239
- $networkDetailsId = (int) $networkDetailsIdSelect[0];
240
- } else {
241
- $wpdb->insert('b2s_posts_network_details', array(
242
- 'network_id' => (int) $network_id,
243
- 'network_type' => (int) $network_type,
244
- 'network_auth_id' => (int) $network_auth_id,
245
- 'network_display_name' => $network_display_name), array('%d', '%d', '%d', '%s'));
246
- $networkDetailsId = $wpdb->insert_id;
247
- }
248
-
249
- if ($networkDetailsId > 0) {
250
- //DeprecatedNetwork-8 31 march
251
- if ($network_id == 8 && $sched_date_utc >= '2019-03-30 23:59:59') {
252
- $wpdb->insert('b2s_posts', array(
253
- 'post_id' => $this->postId,
254
- 'blog_user_id' => $this->blogPostData['blog_user_id'],
255
- 'user_timezone' => $this->blogPostData['user_timezone'],
256
- 'publish_date' => date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate(gmdate('Y-m-d H:i:s'), $this->blogPostData['user_timezone'] * (-1)))),
257
- 'publish_error_code' => 'DEPRECATED_NETWORK_8',
258
- 'network_details_id' => $networkDetailsId), array('%d', '%d', '%s', '%s', '%s', '%d'));
259
- } else {
260
- $wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($shareData), 'image_url' => (isset($shareData['image_url']) ? $shareData['image_url'] : '')), array('%s', '%s'));
261
- $schedDetailsId = $wpdb->insert_id;
262
- $wpdb->insert('b2s_posts', array(
263
- 'post_id' => $this->postId,
264
- 'blog_user_id' => $this->blogPostData['blog_user_id'],
265
- 'user_timezone' => $this->blogPostData['user_timezone'],
266
- 'publish_date' => (($sched_type == 3) ? $sched_date : "0000-00-00 00:00:00"),
267
- 'sched_details_id' => $schedDetailsId,
268
- 'sched_type' => $sched_type,
269
- 'sched_date' => $sched_date,
270
- 'sched_date_utc' => $sched_date_utc,
271
- 'network_details_id' => $networkDetailsId,
272
- 'post_for_approve' => (int) $shareApprove,
273
- 'hook_action' => (((int) $shareApprove == 0) ? 1 : 0)), array('%d', '%d', '%s', '%s', '%d', '%d', '%s', '%s', '%d', '%d', '%d'));
274
- B2S_Rating::trigger();
275
- }
276
- }
277
- }
278
-
279
- }
1
+ <?php
2
+
3
+ class B2S_AutoPost {
4
+
5
+ private $title;
6
+ private $contentHtml;
7
+ private $postId;
8
+ private $content;
9
+ private $excerpt;
10
+ private $url;
11
+ private $imageUrl;
12
+ private $keywords;
13
+ private $blogPostData = array();
14
+ private $myTimeSettings = array();
15
+ private $current_user_date;
16
+ private $setPreFillText;
17
+ private $optionPostFormat;
18
+ private $allowHashTag;
19
+
20
+ function __construct($postId = 0, $blogPostData = array(), $current_user_date = '0000-00-00 00:00:00', $myTimeSettings = false, $title = '', $content = '', $excerpt = '', $url = '', $imageUrl = '', $keywords = '', $b2sPostLang = 'en', $optionPostFormat = array(), $allowHashTag = true) {
21
+ $this->postId = $postId;
22
+ $this->blogPostData = $blogPostData;
23
+ $this->current_user_date = $current_user_date;
24
+ $this->myTimeSettings = $myTimeSettings;
25
+ $this->title = $title;
26
+ $this->content = B2S_Util::prepareContent($postId, $content, $url, false, true, $b2sPostLang);
27
+ $this->excerpt = B2S_Util::prepareContent($postId, $excerpt, $url, false, true, $b2sPostLang);
28
+ $this->contentHtml = B2S_Util::prepareContent($postId, $content, $url, '<p><h1><h2><br><i><b><a><img>', true, $b2sPostLang);
29
+ $this->url = $url;
30
+ $this->imageUrl = $imageUrl;
31
+ $this->keywords = $keywords;
32
+ $this->optionPostFormat = $optionPostFormat;
33
+ $this->allowHashTag = $allowHashTag;
34
+ $this->setPreFillText = array(0 => array(6 => 300, 8 => 239, 9 => 200, 10 => 442, 16 => 250, 17 => 442, 18 => 800), 1 => array(8 => 1200, 10 => 442, 17 => 442, 19 => 239), 2 => array(8 => 239, 10 => 442, 17 => 442, 19 => 239), 20 => 300);
35
+ $this->setPreFillTextLimit = array(0 => array(6 => 400, 8 => 400, 9 => 200, 10 => 500, 18 => 1000, 20 => 400), 1 => array(8 => 1200, 10 => 500, 19 => 400), 2 => array(8 => 400, 10 => 500, 19 => 9000));
36
+ }
37
+
38
+ public function prepareShareData($networkAuthId = 0, $networkId = 0, $networkType = 0) {
39
+ if ((int) $networkId > 0 && (int) $networkAuthId > 0) {
40
+ $postData = array('content' => '', 'custom_title' => '', 'tags' => array(), 'network_auth_id' => (int) $networkAuthId);
41
+
42
+ if (B2S_PLUGIN_USER_VERSION < 1 || $this->optionPostFormat == false || !isset($this->optionPostFormat[$networkId][$networkType])) {
43
+ $this->optionPostFormat = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
44
+ }
45
+
46
+ //V5.6.1
47
+ if (!isset($this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_max'])) {
48
+ $defaultSchema = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
49
+ $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_max'] = $defaultSchema[$networkId][$networkType]['short_text']['excerpt_range_max'];
50
+ }
51
+ if (!isset($this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_min'])) {
52
+ $defaultSchema = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
53
+ $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_min'] = $defaultSchema[$networkId][$networkType]['short_text']['excerpt_range_min'];
54
+ }
55
+
56
+ //PostFormat
57
+ if (in_array($networkId, array(1, 2, 3, 12)) || ($networkId == 19 && $networkType == 0)) {
58
+ //Get: client settings
59
+ if (isset($this->optionPostFormat[$networkId][$networkType]['format']) && ((int) $this->optionPostFormat[$networkId][$networkType]['format'] === 0 || (int) $this->optionPostFormat[$networkId][$networkType]['format'] === 1)) {
60
+ $postData['post_format'] = (int) $this->optionPostFormat[$networkId][$networkType]['format'];
61
+ } else {
62
+ //Set: default settings
63
+ $defaultPostFormat = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
64
+ $postData['post_format'] = isset($defaultPostFormat[$networkId][$networkType]['format']) ? (int) $defaultPostFormat[$networkId][$networkType]['format'] : 0;
65
+ }
66
+ }
67
+ //Special
68
+ if (in_array($networkId, array(1, 2, 3, 12)) || ($networkId == 19 && $networkType == 0)) {
69
+ if ($networkId == 12 && $this->imageUrl == false) {
70
+ return false;
71
+ }
72
+ $postData['content'] = $this->optionPostFormat[$networkId][$networkType]['content'];
73
+
74
+ $preContent = addcslashes(B2S_Util::getExcerpt($this->content, (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['range_min'], (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['range_max']),"\\$");
75
+ $postData['content'] = preg_replace("/\{CONTENT\}/", $preContent, $postData['content']);
76
+
77
+ $title = strip_tags($this->title);
78
+ $postData['content'] = preg_replace("/\{TITLE\}/", addcslashes($title,"\\$"), $postData['content']);
79
+
80
+ $excerpt = (isset($this->excerpt) && !empty($this->excerpt)) ? addcslashes(B2S_Util::getExcerpt($this->excerpt, (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_min'], (int) $this->optionPostFormat[$networkId][$networkType]['short_text']['excerpt_range_max']),"\\$") : '';
81
+ $postData['content'] = preg_replace("/\{EXCERPT\}/", $excerpt, $postData['content']);
82
+
83
+ if (strpos($postData['content'], "{KEYWORDS}") !== false) {
84
+ $hashtags = $this->getHashTagsString("");
85
+ $postData['content'] = preg_replace("/\{KEYWORDS\}/", addcslashes($hashtags,"\\$"), $postData['content']);
86
+ } else if ($this->allowHashTag) {
87
+ $add = ($networkId != 2) ? "\n\n" : "";
88
+ $hashtags = $this->getHashTagsString($add);
89
+ $postData['content'] .= " " . $hashtags;
90
+ }
91
+ }
92
+
93
+ if ($networkId == 4) {
94
+ $postData['custom_title'] = strip_tags($this->title);
95
+ $postData['content'] = $this->contentHtml;
96
+ if ($this->allowHashTag) {
97
+ if (is_array($this->keywords) && !empty($this->keywords)) {
98
+ foreach ($this->keywords as $tag) {
99
+ $postData['tags'][] = str_replace(" ", "", $tag->name);
100
+ }
101
+ }
102
+ }
103
+ }
104
+
105
+ if ($networkId == 6 || $networkId == 20) {
106
+ if ($this->imageUrl !== false) {
107
+ $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (int) $this->setPreFillTextLimit[$networkType][$networkId]) : $this->content;
108
+ if ($this->allowHashTag) {
109
+ $postData['content'] .= $this->getHashTagsString();
110
+ }
111
+ } else {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ if ($networkId == 7) {
117
+ if ($this->imageUrl !== false) {
118
+ $postData['custom_title'] = strip_tags($this->title);
119
+ } else {
120
+ return false;
121
+ }
122
+ }
123
+ if ($networkId == 8 || ($networkId == 19 && $networkType != 0)) {
124
+ $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (int) $this->setPreFillTextLimit[$networkType][$networkId]) : $this->content;
125
+ $postData['custom_title'] = strip_tags($this->title);
126
+ }
127
+ if ($networkId == 9 || $networkId == 16) {
128
+ $postData['custom_title'] = $this->title;
129
+ $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (int) $this->setPreFillTextLimit[$networkType][$networkId]) : $this->content;
130
+ if ($this->allowHashTag) {
131
+ if (is_array($this->keywords) && !empty($this->keywords)) {
132
+ foreach ($this->keywords as $tag) {
133
+ $postData['tags'][] = str_replace(" ", "", $tag->name);
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ if ($networkId == 10 || $networkId == 17 || $networkId == 18) {
140
+ $postData['content'] = (isset($this->setPreFillText[$networkType][$networkId])) ? B2S_Util::getExcerpt($this->content, (int) $this->setPreFillText[$networkType][$networkId], (isset($this->setPreFillTextLimit[$networkType][$networkId]) ? (int) $this->setPreFillTextLimit[$networkType][$networkId] : false)) : $this->content;
141
+ if ($this->allowHashTag) {
142
+ $postData['content'] .= $this->getHashTagsString();
143
+ }
144
+ }
145
+
146
+ if ($networkId == 11 || $networkId == 14) {
147
+ $postData['custom_title'] = strip_tags($this->title);
148
+ $postData['content'] = $this->contentHtml;
149
+ }
150
+
151
+ if ($networkId == 11) {
152
+ if ($this->allowHashTag) {
153
+ if (is_array($this->keywords) && !empty($this->keywords)) {
154
+ foreach ($this->keywords as $tag) {
155
+ $postData['tags'][] = str_replace(" ", "", $tag->name);
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ if ($networkId == 13 || $networkId == 15) {
162
+ $postData['content'] = strip_tags($this->title);
163
+ }
164
+ return $postData;
165
+ }
166
+ return false;
167
+ }
168
+
169
+ private function getHashTagsString($add = "\n\n") {
170
+ $hashTags = '';
171
+ if (is_array($this->keywords) && !empty($this->keywords)) {
172
+ foreach ($this->keywords as $tag) {
173
+ $hashTags .= ' #' . str_replace(array(" ", "-", '"', "'", "!", "?", ",", ".", ";", ":"), "", $tag->name);
174
+ }
175
+ }
176
+ return (!empty($hashTags) ? (!empty($add) ? $add . $hashTags : $hashTags) : '');
177
+ }
178
+
179
+ public function saveShareData($shareData = array(), $network_id = 0, $network_type = 0, $network_auth_id = 0, $shareApprove = 0, $network_display_name = '') {
180
+
181
+ $sched_type = $this->blogPostData['sched_type'];
182
+ $sched_date = $this->blogPostData['sched_date'];
183
+ $sched_date_utc = $this->blogPostData['sched_date_utc'];
184
+
185
+ //Scheduling post once with user times
186
+ if ($sched_type == 2 && $this->myTimeSettings !== false && is_array($this->myTimeSettings) && isset($this->myTimeSettings['times']) && is_array($this->myTimeSettings['times']) && isset($this->myTimeSettings['type'])) {
187
+ //V 5.1.0 Seeding
188
+ //0=default(best time), 1= special per account (seeding), 2= per network (old)
189
+ //Check My Time Setting in Past
190
+ //new
191
+ if ($this->myTimeSettings['type'] == 1) {
192
+ 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])) {
193
+ $tempSchedDate = date('Y-m-d', strtotime($sched_date));
194
+ $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $this->myTimeSettings['times']['time'][$network_auth_id]));
195
+ if ($this->myTimeSettings['times']['delay_day'][$network_auth_id] > 0) {
196
+ $sched_date = date('Y-m-d H:i:s', strtotime('+' . $this->myTimeSettings['times']['delay_day'][$network_auth_id] . ' days', strtotime($networkSchedDate)));
197
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
198
+ } else {
199
+ if ($networkSchedDate >= $sched_date) {
200
+ //Scheduling
201
+ $sched_date = $networkSchedDate;
202
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
203
+ } else {
204
+ //Scheduling on next Day by Past
205
+ $sched_date = date('Y-m-d H:i:s', strtotime('+1 days', strtotime($networkSchedDate)));
206
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
207
+ }
208
+ }
209
+ }
210
+ //old or default (best time)
211
+ } else {
212
+ foreach ($this->myTimeSettings['times'] as $k => $v) {
213
+ if ($v->network_id == $network_id && $v->network_type == $network_type) {
214
+ if (isset($v->sched_time) && !empty($v->sched_time)) {
215
+ $tempSchedDate = date('Y-m-d', strtotime($sched_date));
216
+ $networkSchedDate = date('Y-m-d H:i:00', strtotime($tempSchedDate . ' ' . $v->sched_time));
217
+ if ($networkSchedDate >= $sched_date) {
218
+ //Scheduling
219
+ $sched_date = $networkSchedDate;
220
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
221
+ } else {
222
+ //Scheduling on next Day by Past
223
+ $sched_date = date('Y-m-d H:i:s', strtotime('+1 days', strtotime($networkSchedDate)));
224
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $this->blogPostData['user_timezone'] * (-1))));
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+
232
+ global $wpdb;
233
+ $networkDetailsId = 0;
234
+ $schedDetailsId = 0;
235
+ $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $network_auth_id));
236
+ if (isset($networkDetailsIdSelect[0])) {
237
+ $networkDetailsId = (int) $networkDetailsIdSelect[0];
238
+ } else {
239
+ $wpdb->insert('b2s_posts_network_details', array(
240
+ 'network_id' => (int) $network_id,
241
+ 'network_type' => (int) $network_type,
242
+ 'network_auth_id' => (int) $network_auth_id,
243
+ 'network_display_name' => $network_display_name), array('%d', '%d', '%d', '%s'));
244
+ $networkDetailsId = $wpdb->insert_id;
245
+ }
246
+
247
+ if ($networkDetailsId > 0) {
248
+ //DeprecatedNetwork-8 31 march
249
+ if ($network_id == 8 && $sched_date_utc >= '2019-03-30 23:59:59') {
250
+ $wpdb->insert('b2s_posts', array(
251
+ 'post_id' => $this->postId,
252
+ 'blog_user_id' => $this->blogPostData['blog_user_id'],
253
+ 'user_timezone' => $this->blogPostData['user_timezone'],
254
+ 'publish_date' => date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate(gmdate('Y-m-d H:i:s'), $this->blogPostData['user_timezone'] * (-1)))),
255
+ 'publish_error_code' => 'DEPRECATED_NETWORK_8',
256
+ 'network_details_id' => $networkDetailsId), array('%d', '%d', '%s', '%s', '%s', '%d'));
257
+ } else {
258
+ $wpdb->insert('b2s_posts_sched_details', array('sched_data' => serialize($shareData), 'image_url' => (isset($shareData['image_url']) ? $shareData['image_url'] : '')), array('%s', '%s'));
259
+ $schedDetailsId = $wpdb->insert_id;
260
+ $wpdb->insert('b2s_posts', array(
261
+ 'post_id' => $this->postId,
262
+ 'blog_user_id' => $this->blogPostData['blog_user_id'],
263
+ 'user_timezone' => $this->blogPostData['user_timezone'],
264
+ 'publish_date' => (($sched_type == 3) ? $sched_date : "0000-00-00 00:00:00"),
265
+ 'sched_details_id' => $schedDetailsId,
266
+ 'sched_type' => $sched_type,
267
+ 'sched_date' => $sched_date,
268
+ 'sched_date_utc' => $sched_date_utc,
269
+ 'network_details_id' => $networkDetailsId,
270
+ 'post_for_approve' => (int) $shareApprove,
271
+ 'hook_action' => (((int) $shareApprove == 0) ? 1 : 0)), array('%d', '%d', '%s', '%s', '%d', '%d', '%s', '%s', '%d', '%d', '%d'));
272
+ B2S_Rating::trigger();
273
+ }
274
+ }
275
+ }
276
+
277
+ }
 
 
includes/B2S/Calendar/Item.php CHANGED
@@ -51,7 +51,7 @@ class B2S_Calendar_Item {
51
  ->setPostForApprove($data->post_for_approve)
52
  ->setPublishLink($data->publish_link);
53
 
54
- if ($data->network_id == 1 || $data->network_id == 2 || $data->network_id == 3) {
55
  $this->setPostFormat();
56
  }
57
  if ($data->network_id == 2 && isset($data->relay_primary_sched_date)) {
51
  ->setPostForApprove($data->post_for_approve)
52
  ->setPublishLink($data->publish_link);
53
 
54
+ if ($data->network_id == 1 || $data->network_id == 2 || $data->network_id == 3 || ($data->network_id == 19 && $data->network_type == 0)) {
55
  $this->setPostFormat();
56
  }
57
  if ($data->network_id == 2 && isset($data->relay_primary_sched_date)) {
includes/B2S/Curation/View.php CHANGED
@@ -67,7 +67,7 @@ class B2S_Curation_View {
67
  $content .='<input type = "text" placeholder = "' . __('Date', 'blog2social') . '" name = "ship_date" id="b2s-post-curation-ship-date" class = "b2s-post-curation-ship-date form-control b2s-input" disabled = "disabled" readonly data-timepicker="true" data-language="' . substr(B2S_LANGUAGE, 0, 2) . '" data-time-format="' . $timeFormat . '" data-date-format="' . $dateFormat . '">';
68
  $content .='</div>';
69
  $content .='<div class="col-xs-12 col-sm-5 col-lg-3">';
70
- $content .='<label for="b2s-curation-profile-select">' . __('Select profile:', 'blog2social') . '</label>';
71
  $content .='<select style="width:100%;" id="b2s-post-curation-profile-select" class="b2s-select" name="profile_select">';
72
  foreach ($mandant as $k => $m) {
73
  $content .= '<option value="' . $m->id . '">' . $m->name . '</option>';
67
  $content .='<input type = "text" placeholder = "' . __('Date', 'blog2social') . '" name = "ship_date" id="b2s-post-curation-ship-date" class = "b2s-post-curation-ship-date form-control b2s-input" disabled = "disabled" readonly data-timepicker="true" data-language="' . substr(B2S_LANGUAGE, 0, 2) . '" data-time-format="' . $timeFormat . '" data-date-format="' . $dateFormat . '">';
68
  $content .='</div>';
69
  $content .='<div class="col-xs-12 col-sm-5 col-lg-3">';
70
+ $content .='<label for="b2s-curation-profile-select">' . __('Select network collection:', 'blog2social') . '</label>';
71
  $content .='<select style="width:100%;" id="b2s-post-curation-profile-select" class="b2s-select" name="profile_select">';
72
  foreach ($mandant as $k => $m) {
73
  $content .= '<option value="' . $m->id . '">' . $m->name . '</option>';
includes/B2S/Network/Item.php CHANGED
@@ -155,7 +155,7 @@ class B2S_Network_Item {
155
  $html .= (B2S_PLUGIN_USER_VERSION > 1 || (B2S_PLUGIN_USER_VERSION == 1 && $networkId != 8)) ? '<button onclick="wop(\'' . $b2sAuthUrl . '&choose=group\', \'Blog2Social Network\'); return false;" class="btn btn-primary btn-sm b2s-network-auth-btn">+ ' . $name . '</button>' : '<a href="#" class="btn btn-primary btn-sm b2s-network-auth-btn b2s-btn-disabled" data-toggle="modal" data-title="' . __('You want to connect a social media group?', 'blog2social') . '" data-type="auth-network" data-target="#' . ((B2S_PLUGIN_USER_VERSION == 0) ? 'b2sPreFeatureModal' : 'b2sProFeatureModal') . '">+ ' . $name . ' <span class="label label-success">' . __("PREMIUM", "blog2social") . '</span></a>';
156
  }
157
  if (array_key_exists($networkId, unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT))) {
158
- $html .= (B2S_PLUGIN_USER_VERSION >= 1) ? '<button onclick="return false;" class="btn btn-primary btn-sm b2s-network-auth-btn b2s-edit-template-btn" data-network-id="' . $networkId . '"><i class="glyphicon glyphicon-pencil"></i> ' . __('Edit Post Format', 'blog2social') . '</button>' : '<button onclick="return false;" class="btn btn-primary btn-sm b2s-network-auth-btn b2s-edit-template-btn b2s-btn-disabled" data-network-id="' . $networkId . '"><i class="glyphicon glyphicon-pencil"></i> ' . __('Edit Post Format', 'blog2social') . ' <span class="label label-success">' . __("PREMIUM", "blog2social") . '</span></button>';
159
  }
160
 
161
  $html .= '</span></h4>';
@@ -517,7 +517,7 @@ class B2S_Network_Item {
517
  }
518
  $html .= '<div class="row">';
519
  $html .= '<div class="col-sm-12">';
520
- if (count($schema) > 1) {
521
  $html .= '<div class="pull-left ' . ((B2S_PLUGIN_USER_VERSION < 1) ? 'b2s-btn-disabled' : '') . '">';
522
  $html .= '<ul class="nav nav-pills">';
523
  $html .= '<li class="active"><a href="#b2s-template-profile" class="b2s-template-profile" data-toggle="tab">' . __('Profile', 'blog2social') . '</a></li>';
@@ -849,6 +849,57 @@ class B2S_Network_Item {
849
  $preview .= '</div>';
850
  $preview .= '</div>';
851
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
  default:
853
  break;
854
  }
155
  $html .= (B2S_PLUGIN_USER_VERSION > 1 || (B2S_PLUGIN_USER_VERSION == 1 && $networkId != 8)) ? '<button onclick="wop(\'' . $b2sAuthUrl . '&choose=group\', \'Blog2Social Network\'); return false;" class="btn btn-primary btn-sm b2s-network-auth-btn">+ ' . $name . '</button>' : '<a href="#" class="btn btn-primary btn-sm b2s-network-auth-btn b2s-btn-disabled" data-toggle="modal" data-title="' . __('You want to connect a social media group?', 'blog2social') . '" data-type="auth-network" data-target="#' . ((B2S_PLUGIN_USER_VERSION == 0) ? 'b2sPreFeatureModal' : 'b2sProFeatureModal') . '">+ ' . $name . ' <span class="label label-success">' . __("PREMIUM", "blog2social") . '</span></a>';
156
  }
157
  if (array_key_exists($networkId, unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT))) {
158
+ $html .= (B2S_PLUGIN_USER_VERSION >= 1) ? '<button onclick="return false;" class="btn btn-primary btn-sm b2s-network-auth-btn b2s-edit-template-btn" data-network-id="' . $networkId . '"><i class="glyphicon glyphicon-pencil"></i> ' . __('Edit Post Format', 'blog2social') . '</button>' : '<button onclick="return false;" class="btn btn-primary btn-sm b2s-network-auth-btn b2s-edit-template-btn b2s-btn-disabled" data-network-id="' . $networkId . '"><i class="glyphicon glyphicon-pencil"></i> ' . __('Edit Post Template', 'blog2social') . ' <span class="label label-success">' . __("PREMIUM", "blog2social") . '</span></button>';
159
  }
160
 
161
  $html .= '</span></h4>';
517
  }
518
  $html .= '<div class="row">';
519
  $html .= '<div class="col-sm-12">';
520
+ if (count($schema) > 1 || $networkId == 19) {
521
  $html .= '<div class="pull-left ' . ((B2S_PLUGIN_USER_VERSION < 1) ? 'b2s-btn-disabled' : '') . '">';
522
  $html .= '<ul class="nav nav-pills">';
523
  $html .= '<li class="active"><a href="#b2s-template-profile" class="b2s-template-profile" data-toggle="tab">' . __('Profile', 'blog2social') . '</a></li>';
849
  $preview .= '</div>';
850
  $preview .= '</div>';
851
  break;
852
+ case '19':
853
+ $preview .= '<div class="row">';
854
+ $preview .= '<div class="col-sm-2">';
855
+ $preview .= '<span class="b2s-edit-template-section-headline">' . __('Preview', 'blog2social') . ':</span>';
856
+ $preview .= '</div>';
857
+ $preview .= '<div class="col-sm-8 b2s-edit-template-preview-border b2s-edit-template-preview-border-19">';
858
+ $preview .= '<div class="row">';
859
+ $preview .= '<div class="col-sm-2">';
860
+ $preview .= '<img class="b2s-edit-template-preview-profile-img-19" src="' . plugins_url('/assets/images/b2s@64.png', B2S_PLUGIN_FILE) . '">';
861
+ $preview .= '</div>';
862
+ $preview .= '<div class="col-sm-10">';
863
+ $preview .= '<span class="b2s-edit-template-preview-profile-name-19">Blog2Social</span>';
864
+ $preview .= '</div>';
865
+ $preview .= '</div>';
866
+ $preview .= '<div class="b2s-edit-template-link-preview" data-network-type="' . $networkType . '" ' . (((int) $schema[$networkType]['format'] == 0) ? '' : 'style="display: none;"') . '>';
867
+ $preview .= '<div class="row b2s-edit-template-preview-header-19">';
868
+ $preview .= '<div class="col-sm-12 b2s-edit-template-preview-content-19">';
869
+ $preview .= '<span class="b2s-edit-template-preview-content" data-network-type="' . $networkType . '">' . preg_replace("/\n/", "<br>", $schema[$networkType]['content']) . '</span>';
870
+ $preview .= '</div>';
871
+ $preview .= '</div>';
872
+ $preview .= '<div class="row">';
873
+ $preview .= '<div class="col-sm-4 b2s-edit-template-preview-image-border-19">';
874
+ $preview .= '<img class="b2s-edit-template-preview-link-image b2s-edit-template-preview-link-image-19" src="' . plugins_url('/assets/images/no-image.png', B2S_PLUGIN_FILE) . '">';
875
+ $preview .= '</div>';
876
+ $preview .= '<div class="col-sm-8 b2s-edit-template-preview-link-meta-box-19">';
877
+ $preview .= '<span class="b2s-edit-template-preview-link-meta-box-title-19">' . $title . '</span><br>';
878
+ $preview .= '<span class="b2s-edit-template-preview-link-meta-box-desc-19">' . $desc . '</span><br>';
879
+ $preview .= '<span class="b2s-edit-template-preview-link-meta-box-domain-19">' . $domain . '</span>';
880
+ $preview .= '</div>';
881
+ $preview .= '</div>';
882
+ $preview .= '</div>';
883
+ $preview .= '<div class="b2s-edit-template-image-preview" data-network-type="' . $networkType . '" ' . (((int) $schema[$networkType]['format'] == 1) ? '' : 'style="display: none;"') . '>';
884
+ $preview .= '<div class="row">';
885
+ $preview .= '<div class="col-sm-12 b2s-edit-template-preview-content-19">';
886
+ $preview .= '<span class="b2s-edit-template-preview-content" data-network-type="' . $networkType . '">' . preg_replace("/\n/", "<br>", $schema[$networkType]['content']) . '</span>';
887
+ $preview .= '</div>';
888
+ $preview .= '</div>';
889
+ $preview .= '<div class="row">';
890
+ $preview .= '<div class="col-sm-12 b2s-edit-template-preview-image-border-19">';
891
+ $preview .= '<img class="b2s-edit-template-preview-image-image b2s-edit-template-preview-image-image-19" src="' . plugins_url('/assets/images/no-image.png', B2S_PLUGIN_FILE) . '">';
892
+ $preview .= '</div>';
893
+ $preview .= '</div>';
894
+ $preview .= '</div>';
895
+ $preview .= '<div class="row">';
896
+ $preview .= '<div class="col-sm-12">';
897
+ $preview .= '<img class="b2s-edit-template-preview-like-icons-19" src="' . plugins_url('/assets/images/settings/like-icons-19.png', B2S_PLUGIN_FILE) . '">';
898
+ $preview .= '</div>';
899
+ $preview .= '</div>';
900
+ $preview .= '</div>';
901
+ $preview .= '</div>';
902
+ break;
903
  default:
904
  break;
905
  }
includes/B2S/Post/Filter.php CHANGED
@@ -145,14 +145,14 @@ class B2S_Post_Filter {
145
  $this->postFilter .= '<div class="form-group">
146
  <input id="b2sSortPostTitle" name="b2sSortPostTitle" maxlength="30" class="form-control b2s-input input-sm" value="' . (empty($this->searchPostTitle) ? '' : $this->searchPostTitle) . '" placeholder="' . (empty($this->searchPostTitle) ? __('Search Title', 'blog2social') : '') . '" type="text">
147
  </div>';
148
- if (B2S_PLUGIN_ADMIN) {
149
  $this->postFilter .= $this->getAutorHtml();
150
  }
151
  if($this->type != 'draft') {
152
  $this->postFilter .= $this->getPostCatHtml();
153
  $this->postFilter .= $this->getPostTypeHtml();
154
 
155
- if ($this->type == 'all') {
156
  $this->postFilter .= $this->getPostStatusHtml();
157
  $this->postFilter .= $this->getPostShareStatusHtml();
158
  }
145
  $this->postFilter .= '<div class="form-group">
146
  <input id="b2sSortPostTitle" name="b2sSortPostTitle" maxlength="30" class="form-control b2s-input input-sm" value="' . (empty($this->searchPostTitle) ? '' : $this->searchPostTitle) . '" placeholder="' . (empty($this->searchPostTitle) ? __('Search Title', 'blog2social') : '') . '" type="text">
147
  </div>';
148
+ if (B2S_PLUGIN_ADMIN && $this->type != 'draft-post') {
149
  $this->postFilter .= $this->getAutorHtml();
150
  }
151
  if($this->type != 'draft') {
152
  $this->postFilter .= $this->getPostCatHtml();
153
  $this->postFilter .= $this->getPostTypeHtml();
154
 
155
+ if ($this->type == 'all' || $this->type == 'draft-post') {
156
  $this->postFilter .= $this->getPostStatusHtml();
157
  $this->postFilter .= $this->getPostShareStatusHtml();
158
  }
includes/B2S/Post/Item.php CHANGED
@@ -223,23 +223,47 @@ class B2S_Post_Item {
223
  }
224
 
225
  if ($this->type == 'draft') {
226
- $sqlPosts = "SELECT posts.`ID`, posts.`post_author`, posts.`post_date`, posts.`post_type`, posts.`post_status`, posts.`post_title`, posts.`post_content`, posts.`guid`
 
227
  FROM `$wpdb->posts` posts $leftJoin $leftJoin2
228
  LEFT JOIN b2s_posts ON posts.ID = b2s_posts.post_id
229
  WHERE (posts.`post_type` LIKE '%b2s_ex_post%')
230
- AND b2s_posts.post_id IS NULL
231
  $addSearchAuthorId $addSearchPostTitle $addNotAdmin $leftJoinWhere
232
  ORDER BY `" . $order . "` " . $sortType . "
233
  LIMIT " . (($this->currentPage - 1) * $this->results_per_page) . "," . $this->results_per_page;
234
- $this->postData = $wpdb->get_results($sqlPosts);
235
 
236
- $sqlPostsTotal = "SELECT COUNT(*)
237
  FROM `$wpdb->posts` posts $leftJoin $leftJoin2
238
  LEFT JOIN b2s_posts ON posts.ID = b2s_posts.post_id
239
  WHERE (posts.`post_type` LIKE '%b2s_ex_post%')
240
- AND b2s_posts.post_id IS NULL
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  $addSearchAuthorId $addSearchPostTitle $addNotAdmin $leftJoinWhere";
242
- $this->postTotal = $wpdb->get_var($sqlPostsTotal);
 
243
  }
244
  }
245
 
@@ -248,7 +272,11 @@ class B2S_Post_Item {
248
  $postStatus = array('publish' => __('published', 'blog2social'), 'pending' => __('draft', 'blog2social'), 'future' => __('scheduled', 'blog2social'));
249
 
250
  if (empty($this->postData)) {
251
- $text = __('You have no posts published or scheduled.', 'blog2social');
 
 
 
 
252
  return '<li class="list-group-item"><div class="media"><div class="media-body"></div>' . $text . '</div></li>';
253
  }
254
 
@@ -368,19 +396,42 @@ class B2S_Post_Item {
368
  $lastPublish = ($lastPublish != false) ? ' | ' . __('last shared on social media', 'blog2social') . ' ' . B2S_Util::getCustomDateFormat($lastPublish, substr(B2S_LANGUAGE, 0, 2)) : '';
369
  $url = (!empty($browser)) ? get_post_meta($var->ID, "b2s_original_url", true) : $var->guid;
370
 
371
- $this->postItem .= '<li class="list-group-item">
372
  <div class="media">
373
  <img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
374
  <div class="media-body">
375
  <strong><a target="_blank" href="' . $url . '">' . $postTitle . '</a></strong>' . $browser . '
376
- <span class="pull-right b2s-publish-btn">
377
  <a class="btn btn-primary btn-sm publishPostBtn" href="admin.php?page=blog2social-curation&postId=' . $var->ID . '&url=' . urlencode($url) . '&title=' . urlencode($var->post_title) . '&comment=' . urlencode($var->post_content) . '">' . __('Share on Social Media', 'blog2social') . '</a>
378
  </span>
 
 
 
379
  <p class="info hidden-xs">#' . $var->ID . ' | ' . __('Author', 'blog2social') . ' <a href="' . get_author_posts_url($var->post_author) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> | ' . __('saved', 'blog2social') . ': ' . B2S_Util::getCustomDateFormat($var->post_date, substr(B2S_LANGUAGE, 0, 2)) . $lastPublish . '</p>
380
  </div>
381
  </div>
382
  </li>';
383
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
385
 
386
  return html_entity_decode($this->postItem, ENT_COMPAT, 'UTF-8');
223
  }
224
 
225
  if ($this->type == 'draft') {
226
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts'") == 'b2s_posts') {
227
+ $sqlPosts = "SELECT posts.`ID`, posts.`post_author`, posts.`post_date`, posts.`post_type`, posts.`post_status`, posts.`post_title`, posts.`post_content`, posts.`guid`
228
  FROM `$wpdb->posts` posts $leftJoin $leftJoin2
229
  LEFT JOIN b2s_posts ON posts.ID = b2s_posts.post_id
230
  WHERE (posts.`post_type` LIKE '%b2s_ex_post%')
231
+ AND b2s_posts.post_id IS NULL AND (posts.`post_status` = 'private' OR posts.`post_status` = 'draft')
232
  $addSearchAuthorId $addSearchPostTitle $addNotAdmin $leftJoinWhere
233
  ORDER BY `" . $order . "` " . $sortType . "
234
  LIMIT " . (($this->currentPage - 1) * $this->results_per_page) . "," . $this->results_per_page;
235
+ $this->postData = $wpdb->get_results($sqlPosts);
236
 
237
+ $sqlPostsTotal = "SELECT COUNT(*)
238
  FROM `$wpdb->posts` posts $leftJoin $leftJoin2
239
  LEFT JOIN b2s_posts ON posts.ID = b2s_posts.post_id
240
  WHERE (posts.`post_type` LIKE '%b2s_ex_post%')
241
+ AND b2s_posts.post_id IS NULL AND (posts.`post_status` = 'private' OR posts.`post_status` = 'draft')
242
+ $addSearchAuthorId $addSearchPostTitle $addNotAdmin $leftJoinWhere";
243
+ $this->postTotal = $wpdb->get_var($sqlPostsTotal);
244
+ }
245
+ }
246
+
247
+ if ($this->type == 'draft-post') {
248
+ if ($wpdb->get_var("SHOW TABLES LIKE 'b2s_posts_drafts'") == 'b2s_posts_drafts') {
249
+ $sqlPosts = "SELECT b2s_posts_drafts.`ID` AS draft_id, posts.`ID`, b2s_posts_drafts.`post_id`, b2s_posts_drafts.`last_save_date`, b2s_posts_drafts.`data`, posts.post_author, posts.post_type, posts.post_title
250
+ FROM `$wpdb->posts` posts LEFT JOIN b2s_posts_drafts ON b2s_posts_drafts.post_id = posts.ID $leftJoin $leftJoin2 $leftJoin3
251
+ WHERE b2s_posts_drafts.`blog_user_id` = " . B2S_PLUGIN_BLOG_USER_ID . "
252
+ AND $postTypes
253
+ AND $addSearchType
254
+ $addSearchAuthorId $addSearchPostTitle $addNotAdmin $leftJoinWhere
255
+ ORDER BY `last_save_date` " . $sortType . "
256
+ LIMIT " . (($this->currentPage - 1) * $this->results_per_page) . "," . $this->results_per_page;
257
+ $this->postData = $wpdb->get_results($sqlPosts);
258
+
259
+ $sqlPostsTotal = "SELECT COUNT(*)
260
+ FROM `$wpdb->posts` posts LEFT JOIN b2s_posts_drafts ON b2s_posts_drafts.post_id = posts.ID $leftJoin $leftJoin2 $leftJoin3
261
+ WHERE b2s_posts_drafts.`blog_user_id` = " . B2S_PLUGIN_BLOG_USER_ID . "
262
+ AND $postTypes
263
+ AND $addSearchType
264
  $addSearchAuthorId $addSearchPostTitle $addNotAdmin $leftJoinWhere";
265
+ $this->postTotal = $wpdb->get_var($sqlPostsTotal);
266
+ }
267
  }
268
  }
269
 
272
  $postStatus = array('publish' => __('published', 'blog2social'), 'pending' => __('draft', 'blog2social'), 'future' => __('scheduled', 'blog2social'));
273
 
274
  if (empty($this->postData)) {
275
+ if ($this->type != 'draft-post') {
276
+ $text = __('You have no posts published or scheduled.', 'blog2social');
277
+ } else {
278
+ $text = __('You have no drafts saved.', 'blog2social');
279
+ }
280
  return '<li class="list-group-item"><div class="media"><div class="media-body"></div>' . $text . '</div></li>';
281
  }
282
 
396
  $lastPublish = ($lastPublish != false) ? ' | ' . __('last shared on social media', 'blog2social') . ' ' . B2S_Util::getCustomDateFormat($lastPublish, substr(B2S_LANGUAGE, 0, 2)) : '';
397
  $url = (!empty($browser)) ? get_post_meta($var->ID, "b2s_original_url", true) : $var->guid;
398
 
399
+ $this->postItem .= '<li class="list-group-item b2s-list-cc-draft" data-blog-post-id="' . $var->ID . '">
400
  <div class="media">
401
  <img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
402
  <div class="media-body">
403
  <strong><a target="_blank" href="' . $url . '">' . $postTitle . '</a></strong>' . $browser . '
404
+ <span class="pull-right padding-left-5 b2s-publish-btn">
405
  <a class="btn btn-primary btn-sm publishPostBtn" href="admin.php?page=blog2social-curation&postId=' . $var->ID . '&url=' . urlencode($url) . '&title=' . urlencode($var->post_title) . '&comment=' . urlencode($var->post_content) . '">' . __('Share on Social Media', 'blog2social') . '</a>
406
  </span>
407
+ <span class="pull-right">
408
+ <button class="btn btn-default btn-sm deleteCcDraftBtn" data-blog-post-id="' . $var->ID . '"><span class="glyphicon glyphicon glyphicon-trash "></span> ' . __('delete', 'blog2social') . '</button>
409
+ </span>
410
  <p class="info hidden-xs">#' . $var->ID . ' | ' . __('Author', 'blog2social') . ' <a href="' . get_author_posts_url($var->post_author) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> | ' . __('saved', 'blog2social') . ': ' . B2S_Util::getCustomDateFormat($var->post_date, substr(B2S_LANGUAGE, 0, 2)) . $lastPublish . '</p>
411
  </div>
412
  </div>
413
  </li>';
414
  }
415
+
416
+ if ($this->type == 'draft-post') {
417
+ $userInfo = get_user_meta($var->post_author);
418
+
419
+ $this->postItem .= '<li class="list-group-item b2s-draft-list-entry" data-b2s-draft-id="' . $var->draft_id . '">
420
+ <div class="media">
421
+ <img class="post-img-10 pull-left hidden-xs" src="' . plugins_url('/assets/images/b2s/' . $postType . '-icon.png', B2S_PLUGIN_FILE) . '" alt="posttype">
422
+ <div class="media-body">
423
+ <strong><a target="_blank" href="' . get_permalink($var->post_id) . '">' . $postTitle . '</a></strong>
424
+ <span class="pull-right b2s-publish-btn">
425
+ <a class="btn btn-primary btn-sm publishPostBtn" href="admin.php?page=blog2social-ship&postId=' . $var->ID . '&type=draft">' . __('Share on Social Media', 'blog2social') . '</a>
426
+ </span>
427
+ <span class="pull-right">
428
+ <a class="btn btn-default btn-sm deleteDraftBtn" data-b2s-draft-id="' . $var->draft_id . '">' . __('delete', 'blog2social') . '</a>
429
+ </span>
430
+ <p class="info hidden-xs">#' . $var->ID . ' | ' . __('Author', 'blog2social') . ' <a href="' . get_author_posts_url($var->post_author) . '">' . (isset($userInfo['nickname'][0]) ? $userInfo['nickname'][0] : '-') . '</a> | ' . __('last saved', 'blog2social') . ': ' . B2S_Util::getCustomDateFormat($var->last_save_date, substr(B2S_LANGUAGE, 0, 2)) . '</p>
431
+ </div>
432
+ </div>
433
+ </li>';
434
+ }
435
  }
436
 
437
  return html_entity_decode($this->postItem, ENT_COMPAT, 'UTF-8');
includes/B2S/PostBox.php CHANGED
@@ -174,7 +174,7 @@ class B2S_PostBox {
174
 
175
  public function getPostBoxAutoHtml($mandant = array(), $auth = array()) {
176
  $authContent = '';
177
- $content = '<br><div class="b2s-meta-box-auto-post-area"><label for="b2s-post-meta-box-profil-dropdown">' . __('Select profile:', 'blog2social') . ' <div style="float:right;"><a href="' . $this->b2sSiteUrl . 'wp-admin/admin.php?page=blog2social-network' . '" target="_blank">' . __('Network settings', 'blog2social') . '</a></div></label>
178
  <select style="width:100%;" id="b2s-post-meta-box-profil-dropdown" name="b2s-post-meta-box-profil-dropdown">';
179
  foreach ($mandant as $k => $m) {
180
  $content .= '<option value="' . $m->id . '">' . (($m->id == 0) ? __($m->name, 'blog2social') : $m->name) . '</option>';
174
 
175
  public function getPostBoxAutoHtml($mandant = array(), $auth = array()) {
176
  $authContent = '';
177
+ $content = '<br><div class="b2s-meta-box-auto-post-area"><label for="b2s-post-meta-box-profil-dropdown">' . __('Select network collection:', 'blog2social') . ' <div style="float:right;"><a href="' . $this->b2sSiteUrl . 'wp-admin/admin.php?page=blog2social-network' . '" target="_blank">' . __('Network settings', 'blog2social') . '</a></div></label>
178
  <select style="width:100%;" id="b2s-post-meta-box-profil-dropdown" name="b2s-post-meta-box-profil-dropdown">';
179
  foreach ($mandant as $k => $m) {
180
  $content .= '<option value="' . $m->id . '">' . (($m->id == 0) ? __($m->name, 'blog2social') : $m->name) . '</option>';
includes/B2S/Settings/Item.php CHANGED
@@ -364,7 +364,7 @@ class B2S_Settings_Item {
364
  $content .='<hr></div>';
365
  }
366
 
367
- foreach (array(1, 2, 3, 12) as $n => $networkId) { //FB,TW,LI,IN
368
  $type = ($networkId == 1) ? array(0, 1, 2) : (($networkId == 3) ? array(0, 1) : array(0));
369
  foreach ($type as $t => $typeId) { //Profile,Page,Group
370
  if(!isset($optionPostFormat[$networkId][$typeId]['format'])){
@@ -410,7 +410,7 @@ class B2S_Settings_Item {
410
  public function setNetworkSettingsHtml() {
411
  $optionPostFormat = $this->options->_getOption('post_template');
412
  $content = "<input type='hidden' class='b2sNetworkSettingsPostFormatText' value='" . json_encode(array('post' => array(__('Link Post', 'blog2social'), __('Image Post', 'blog2social')), 'image' => array(__('Image with frame'), __('Image cut out')))) . "'/>";
413
- foreach (array(1, 2, 3, 12) as $n => $networkId) { //FB,TW,LI,IN
414
  $postFormatType = ($networkId == 12) ? 'image' : 'post';
415
  $type = ($networkId == 1) ? array(0, 1, 2) : (($networkId == 3) ? array(0, 1) : array(0));
416
  foreach ($type as $t => $typeId) { //Profile,Page,Group
364
  $content .='<hr></div>';
365
  }
366
 
367
+ foreach (array(1, 2, 3, 12, 19) as $n => $networkId) { //FB,TW,LI,IN
368
  $type = ($networkId == 1) ? array(0, 1, 2) : (($networkId == 3) ? array(0, 1) : array(0));
369
  foreach ($type as $t => $typeId) { //Profile,Page,Group
370
  if(!isset($optionPostFormat[$networkId][$typeId]['format'])){
410
  public function setNetworkSettingsHtml() {
411
  $optionPostFormat = $this->options->_getOption('post_template');
412
  $content = "<input type='hidden' class='b2sNetworkSettingsPostFormatText' value='" . json_encode(array('post' => array(__('Link Post', 'blog2social'), __('Image Post', 'blog2social')), 'image' => array(__('Image with frame'), __('Image cut out')))) . "'/>";
413
+ foreach (array(1, 2, 3, 12, 19) as $n => $networkId) { //FB,TW,LI,IN
414
  $postFormatType = ($networkId == 12) ? 'image' : 'post';
415
  $type = ($networkId == 1) ? array(0, 1, 2) : (($networkId == 3) ? array(0, 1) : array(0));
416
  foreach ($type as $t => $typeId) { //Profile,Page,Group
includes/B2S/Ship/Item.php CHANGED
@@ -16,7 +16,7 @@ class B2S_Ship_Item {
16
  private $showTitleGroup = array(8, 11, 19);
17
  private $onlyImage = array(6, 7, 12, 20);
18
  private $allowNoImageProfile = array(5, 9);
19
- private $allowNoCustomImageProfile = array(8, 15, 19);
20
  private $allowNoCustomImagePage = array();
21
  private $allowNoEmoji = array(9, 13, 14, 15, 16, 18);
22
  private $allowNoImagePage = array(8);
@@ -88,8 +88,10 @@ class B2S_Ship_Item {
88
  return $this->postId;
89
  }
90
 
91
- public function getItemHtml($data, $show_time = true) {
92
-
 
 
93
  $this->viewMode = (isset($data->view) && !empty($data->view)) ? $data->view : null; //normal or modal(Kalendar)
94
  //Override data values from edit modus
95
  $schedMetaData = ($this->viewMode == 'modal') ? $this->hook_sched_data(array()) : array();
@@ -144,39 +146,43 @@ class B2S_Ship_Item {
144
  $isRequiredTextarea = (in_array($data->networkId, $this->isCommentProfile)) ? '' : 'required="required"';
145
 
146
  //ShortText
147
- if ($data->networkId == 1 || $data->networkId == 2 || $data->networkId == 3 || $data->networkId == 12) {
148
- $message = $this->getMessagebyTemplate($data);
149
  } else {
150
- if (isset($this->setShortTextProfile[$data->networkId]) && (int) $this->setShortTextProfile[$data->networkId] > 0) {
151
- //$preContent = ($data->networkId == 2) ? B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang);
 
 
 
152
 
153
- $preContent = B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang);
154
 
155
- $message = B2S_Util::getExcerpt($preContent, (int) $this->setShortTextProfile[$data->networkId], (isset($this->setShortTextProfileLimit[$data->networkId]) ? (int) $this->setShortTextProfileLimit[$data->networkId] : false));
156
- } else {
157
- $message = (in_array($data->networkId, $this->allowTitleProfile) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang));
158
- }
159
 
160
- //Feature Image Html-Network
161
- if (in_array($data->networkId, $this->allowHtml)) {
162
- $featuredImage = wp_get_attachment_url(get_post_thumbnail_id($this->postId));
163
- if ($featuredImage !== false) {
164
- $title = in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang);
165
- $message = '<img class="b2s-post-item-details-image-html-src" src="' . $featuredImage . '" alt="' . $title . '"/><br />' . $message;
 
166
  }
167
- }
168
 
169
- //Hashtags
170
- if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
171
- $add = ($data->networkId != 2) ? "\n\n" : "";
172
- $message .= $this->getHashTagsString($add);
 
173
  }
174
  }
175
  $message = $this->hook_message($message);
176
 
177
  $countCharacter = 0;
178
  if ($limit !== false) {
179
- $infoCharacterCount = ($data->networkId != 2 && $data->networkId != 3) ? ' (' . __('Text only', 'blog2social') . ')' : '';
180
  $textareaLimitInfo .= '<span class="b2s-post-item-countChar" data-network-count="-1" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . $infoCharacterCount . '</span>';
181
  $textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
182
  } else {
@@ -196,24 +202,27 @@ class B2S_Ship_Item {
196
  $infoImage .= (in_array($data->networkId, $this->allowNoCustomImagePage)) ? (!empty($infoImage) ? ' | ' : '') . __('Network defines image by link', 'blog2social') . '!' : '';
197
 
198
  //ShortText
199
- if ($data->networkId == 1 || $data->networkId == 2 || $data->networkId == 3 || $data->networkId == 12) {
200
- $message = $this->getMessagebyTemplate($data);
201
  } else {
202
- if (isset($this->setShortTextPage[$data->networkId]) && (int) $this->setShortTextPage[$data->networkId] > 0) {
203
- if ($data->networkId == 8) { //Xing -1 Leerzeichen
204
- $this->setShortTextPage[$data->networkId] = (int) $this->setShortTextPage[$data->networkId] - mb_strlen($this->postUrl, 'UTF-8') - 1;
205
- }
206
- $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang), (isset($this->setShortTextPage[$data->networkId]) ? (int) $this->setShortTextPage[$data->networkId] : false), (isset($this->setShortTextPageLimit[$data->networkId]) ? (( is_array($this->setShortTextPageLimit[$data->networkId]) && isset($this->setShortTextPageLimit[$data->networkId][$data->networkKind])) ? (int) $this->setShortTextPageLimit[$data->networkId][$data->networkKind] : (int) $this->setShortTextPageLimit[$data->networkId] ) : false));
207
  } else {
208
- $message = (in_array($data->networkId, $this->allowTitlePage) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang));
209
- }
 
 
 
 
 
 
210
 
211
- //Hashtags
212
- if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
213
- $message .= $this->getHashTagsString();
 
214
  }
215
  }
216
-
217
  $message = $this->hook_message($message);
218
 
219
 
@@ -232,20 +241,23 @@ class B2S_Ship_Item {
232
  case'2':
233
  //group
234
  //ShortText
235
- if ($data->networkId == 1 || $data->networkId == 2 || $data->networkId == 3 || $data->networkId == 12) {
236
- $message = $this->getMessagebyTemplate($data);
237
  } else {
238
- if (isset($this->setShortTextGroup[$data->networkId]) && (int) $this->setShortTextGroup[$data->networkId] > 0) {
239
- $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang), (isset($this->setShortTextGroup[$data->networkId]) ? (int) $this->setShortTextGroup[$data->networkId] : false), (isset($this->setShortTextGroupLimit[$data->networkId]) ? (int) $this->setShortTextGroupLimit[$data->networkId] : false));
240
  } else {
241
- $message = (in_array($data->networkId, $this->allowTitleGroup) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang));
242
- }
243
- //Hashtags
244
- if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
245
- $message .= $this->getHashTagsString();
 
 
 
 
246
  }
247
  }
248
-
249
  $message = $this->hook_message($message);
250
 
251
  $network_display_name = $data->network_display_name;
@@ -290,18 +302,18 @@ class B2S_Ship_Item {
290
 
291
  $content .= '<div class="pull-right hidden-xs b2s-post-item-info-area">';
292
 
293
- if (in_array($data->networkId, $this->setPostFormat)) {
294
  $postFormatType = ($data->networkId == 12) ? 'image' : 'post';
295
  $addCSS = (B2S_PLUGIN_USER_VERSION == 0) ? 'b2s-btn-disabled' : '';
296
  $content .= '<button class="btn btn-xs btn-link b2s-post-ship-item-post-format ' . $addCSS . '" data-post-wp-type="' . $this->b2sPostType . '" data-post-format-type="' . $postFormatType . '" data-network-auth-id="' . $data->networkAuthId . '" data-network-type="' . $data->networkType . '" data-network-id="' . $data->networkId . '" >' . __('post format', 'blog2social') . ': <span class="b2s-post-ship-item-post-format-text" data-post-format-type="' . $postFormatType . '" data-network-auth-id="' . $data->networkAuthId . '" data-network-type="' . $data->networkType . '" data-network-id="' . $data->networkId . '" ></span></button>';
297
  if (B2S_PLUGIN_USER_VERSION > 0) {
298
- $content .= '<input type="hidden" class="b2s-post-item-details-post-format" name="b2s[' . $data->networkAuthId . '][post_format]" data-network-auth-id="' . $data->networkAuthId . '" data-network-id="' . $data->networkId . '" data-network-type="' . $data->networkType . '" value="0" />';
299
  } else {
300
  $content .= '<span class="label label-success"><a target="_blank" class="btn-label-premium b2s-btn-trigger-post-ship-item-post-format" data-network-auth-id="' . $data->networkAuthId . '" href="#">PREMIUM</a></span>';
301
  }
302
  }
303
  $content .='<span class="b2s-post-tool-area" data-network-auth-id="' . $data->networkAuthId . '">';
304
- $content .= (in_array($data->networkId, $this->setPostFormat)) ? ' | ' : '';
305
  if (in_array($data->networkId, $this->getText)) {
306
  $content .= '<button class="btn btn-xs btn-link b2s-post-ship-item-full-text" data-network-id="' . $data->networkId . '" data-network-count="-1" data-network-auth-id="' . $data->networkAuthId . '" >' . __('Insert full-text', 'blog2social') . '</button> | ';
307
  }
@@ -368,6 +380,7 @@ class B2S_Ship_Item {
368
  $content .= '<input type="hidden" class="form-control" name="b2s[' . $data->networkAuthId . '][network_tos_group_id]" value="' . $data->networkTosGroupId . '">';
369
  $content .= '<input type="hidden" class="form-control networkKind" data-network-auth-id="' . $data->networkAuthId . '" name="b2s[' . $data->networkAuthId . '][network_kind]" value="' . $data->networkKind . '">';
370
  $content .= '<input type="hidden" data-network-auth-id="' . $data->networkAuthId . '" class="form-control b2s-post-ship-network-display-name" name="b2s[' . $data->networkAuthId . '][network_display_name]" value="' . $data->network_display_name . '">';
 
371
 
372
  $content .= '</div>';
373
  return $content;
@@ -468,9 +481,11 @@ class B2S_Ship_Item {
468
  $edit = '<textarea class="form-control xing-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '"data-network-count="-1" data-network-id="' . $networkId . '" data-network-text-limit="' . $limitValue . '" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
469
  $edit .= '<div class="row">';
470
  $edit .= '<div class="' . ((isset($this->viewMode) && $this->viewMode == 'modal') ? 'col-xs-12' : 'col-xs-12 col-sm-5 col-lg-3') . '">';
471
- $edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="xing-url-image b2s-post-item-details-url-image center-block img-responsive" data-network-count="-1" data-network-id="' . $networkId . '" data-network-image-change="0" data-network-auth-id="' . $networkAuthId . '">';
 
472
  $edit .= '<input type="hidden" class="b2s-image-url-hidden-field form-control" data-network-count="-1" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" value="' . ($imageUrl ? $imageUrl : "") . '" name="b2s[' . $networkAuthId . '][image_url]">';
473
  $edit .= '<div class="clearfix"></div>';
 
474
  $edit .= '</div>';
475
  $edit .= '<div class="' . ((isset($this->viewMode) && $this->viewMode == 'modal') ? 'col-xs-12"' : 'col-xs-12 col-sm-7 col-lg-9 b2s-post-original-area" data-network-auth-id="' . $networkAuthId . '"') . '>';
476
  $edit .= '<p class="xing-url-title b2s-post-item-details-preview-title hidden-xs" data-network-auth-id="' . $networkAuthId . '">' . (isset($meta['title']) && !empty($meta['title']) ? $meta['title'] : '') . '</p>';
@@ -548,8 +563,11 @@ class B2S_Ship_Item {
548
  if (($networkId == 8 || $networkId == 19) && $networkType == 0) {
549
  $edit = '<div class="row"><br>';
550
  $edit .= '<div class="col-xs-12 col-sm-5 col-lg-3">';
551
- $edit .= '<img src="' . $this->defaultImage . '" class="xing-url-image b2s-post-item-details-url-image center-block img-responsive" data-network-count="' . $schedCount . '" data-network-id="' . $networkId . '" data-network-image-change="0" data-network-auth-id="' . $networkAuthId . '">';
 
552
  $edit .= '<input type="hidden" class="b2s-image-url-hidden-field form-control" data-network-count="' . $schedCount . '" data-network-count="' . $schedCount . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" value="' . ($imageUrl ? $imageUrl : "") . '" name="b2s[' . $networkAuthId . '][sched_image_url][' . $schedCount . ']">';
 
 
553
  $edit .= '</div>';
554
  $edit .= '<div class="col-xs-12 col-sm-7 col-lg-9">';
555
  $edit .= $infoArea;
@@ -723,7 +741,7 @@ class B2S_Ship_Item {
723
 
724
  private function getRelayBtnHtml($networkAuthId, $networkId) {
725
  $relay = '<div class="form-group b2s-post-relay-area-select pull-left"><div class="checkbox checbox-switch switch-success"><label>';
726
- $relay .='<input type="checkbox" class="b2s-post-item-details-relay" data-user-version="' . B2S_PLUGIN_USER_VERSION . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" name="b2s[' . $networkAuthId . '][post_relay]" value="1"/>';
727
  $relay .='<span></span>';
728
  $relay .= __('Enable Retweets for all Tweets with the selected profile', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoPostRelayModal" class="btn-xs hidden-sm">' . __('Info', 'blog2social') . '</a>';
729
  $relay .=' </label></div></div>';
16
  private $showTitleGroup = array(8, 11, 19);
17
  private $onlyImage = array(6, 7, 12, 20);
18
  private $allowNoImageProfile = array(5, 9);
19
+ private $allowNoCustomImageProfile = array(8, 15);
20
  private $allowNoCustomImagePage = array();
21
  private $allowNoEmoji = array(9, 13, 14, 15, 16, 18);
22
  private $allowNoImagePage = array(8);
88
  return $this->postId;
89
  }
90
 
91
+ public function getItemHtml($data, $show_time = true, $draftData = array()) {
92
+
93
+ $isDraft = (empty($draftData)) ? false : true;
94
+
95
  $this->viewMode = (isset($data->view) && !empty($data->view)) ? $data->view : null; //normal or modal(Kalendar)
96
  //Override data values from edit modus
97
  $schedMetaData = ($this->viewMode == 'modal') ? $this->hook_sched_data(array()) : array();
146
  $isRequiredTextarea = (in_array($data->networkId, $this->isCommentProfile)) ? '' : 'required="required"';
147
 
148
  //ShortText
149
+ if($isDraft && isset($draftData['content'])) {
150
+ $message = $draftData['content'];
151
  } else {
152
+ if ($data->networkId == 1 || $data->networkId == 2 || $data->networkId == 3 || $data->networkId == 12 || $data->networkId == 19) {
153
+ $message = $this->getMessagebyTemplate($data);
154
+ } else {
155
+ if (isset($this->setShortTextProfile[$data->networkId]) && (int) $this->setShortTextProfile[$data->networkId] > 0) {
156
+ //$preContent = ($data->networkId == 2) ? B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang);
157
 
158
+ $preContent = B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang);
159
 
160
+ $message = B2S_Util::getExcerpt($preContent, (int) $this->setShortTextProfile[$data->networkId], (isset($this->setShortTextProfileLimit[$data->networkId]) ? (int) $this->setShortTextProfileLimit[$data->networkId] : false));
161
+ } else {
162
+ $message = (in_array($data->networkId, $this->allowTitleProfile) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang));
163
+ }
164
 
165
+ //Feature Image Html-Network
166
+ if (in_array($data->networkId, $this->allowHtml)) {
167
+ $featuredImage = wp_get_attachment_url(get_post_thumbnail_id($this->postId));
168
+ if ($featuredImage !== false) {
169
+ $title = in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang);
170
+ $message = '<img class="b2s-post-item-details-image-html-src" src="' . $featuredImage . '" alt="' . $title . '"/><br />' . $message;
171
+ }
172
  }
 
173
 
174
+ //Hashtags
175
+ if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
176
+ $add = ($data->networkId != 2) ? "\n\n" : "";
177
+ $message .= $this->getHashTagsString($add);
178
+ }
179
  }
180
  }
181
  $message = $this->hook_message($message);
182
 
183
  $countCharacter = 0;
184
  if ($limit !== false) {
185
+ $infoCharacterCount = ($data->networkId != 2 && $data->networkId != 3 && $data->networkId != 19) ? ' (' . __('Text only', 'blog2social') . ')' : '';
186
  $textareaLimitInfo .= '<span class="b2s-post-item-countChar" data-network-count="-1" data-network-auth-id="' . $data->networkAuthId . '">' . (int) $countCharacter . '</span>/' . $limitValue . ' ' . __('characters', 'blog2social') . $infoCharacterCount . '</span>';
187
  $textareaOnKeyUp = 'onkeyup="networkLimitAll(\'' . $data->networkAuthId . '\',\'' . $data->networkId . '\',\'' . $limitValue . '\');"';
188
  } else {
202
  $infoImage .= (in_array($data->networkId, $this->allowNoCustomImagePage)) ? (!empty($infoImage) ? ' | ' : '') . __('Network defines image by link', 'blog2social') . '!' : '';
203
 
204
  //ShortText
205
+ if($isDraft && isset($draftData['content'])) {
206
+ $message = $draftData['content'];
207
  } else {
208
+ if ($data->networkId == 1 || $data->networkId == 2 || $data->networkId == 3 || $data->networkId == 12) {
209
+ $message = $this->getMessagebyTemplate($data);
 
 
 
210
  } else {
211
+ if (isset($this->setShortTextPage[$data->networkId]) && (int) $this->setShortTextPage[$data->networkId] > 0) {
212
+ if ($data->networkId == 8) { //Xing -1 Leerzeichen
213
+ $this->setShortTextPage[$data->networkId] = (int) $this->setShortTextPage[$data->networkId] - mb_strlen($this->postUrl, 'UTF-8') - 1;
214
+ }
215
+ $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang), (isset($this->setShortTextPage[$data->networkId]) ? (int) $this->setShortTextPage[$data->networkId] : false), (isset($this->setShortTextPageLimit[$data->networkId]) ? (( is_array($this->setShortTextPageLimit[$data->networkId]) && isset($this->setShortTextPageLimit[$data->networkId][$data->networkKind])) ? (int) $this->setShortTextPageLimit[$data->networkId][$data->networkKind] : (int) $this->setShortTextPageLimit[$data->networkId] ) : false));
216
+ } else {
217
+ $message = (in_array($data->networkId, $this->allowTitlePage) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang));
218
+ }
219
 
220
+ //Hashtags
221
+ if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
222
+ $message .= $this->getHashTagsString();
223
+ }
224
  }
225
  }
 
226
  $message = $this->hook_message($message);
227
 
228
 
241
  case'2':
242
  //group
243
  //ShortText
244
+ if($isDraft && isset($draftData['content'])) {
245
+ $message = $draftData['content'];
246
  } else {
247
+ if ($data->networkId == 1 || $data->networkId == 2 || $data->networkId == 3 || $data->networkId == 12) {
248
+ $message = $this->getMessagebyTemplate($data);
249
  } else {
250
+ if (isset($this->setShortTextGroup[$data->networkId]) && (int) $this->setShortTextGroup[$data->networkId] > 0) {
251
+ $message = B2S_Util::getExcerpt(B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, false, (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang), (isset($this->setShortTextGroup[$data->networkId]) ? (int) $this->setShortTextGroup[$data->networkId] : false), (isset($this->setShortTextGroupLimit[$data->networkId]) ? (int) $this->setShortTextGroupLimit[$data->networkId] : false));
252
+ } else {
253
+ $message = (in_array($data->networkId, $this->allowTitleGroup) ? (in_array($data->networkId, $this->allowNoEmoji) ? B2S_Util::remove4byte(B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::getTitleByLanguage($this->postData->post_title, $this->userLang)) : B2S_Util::prepareContent($this->postId, $this->postData->post_content, $this->postUrl, (in_array($data->networkId, $this->allowHtml) ? '<p><h1><h2><br><i><b><a><img>' : false), (in_array($data->networkId, $this->allowNoEmoji) ? false : true), $this->userLang));
254
+ }
255
+ //Hashtags
256
+ if (in_array($data->networkId, $this->allowHashTags) && ($allowUserHashTag === false || $allowUserHashTag == 1)) {
257
+ $message .= $this->getHashTagsString();
258
+ }
259
  }
260
  }
 
261
  $message = $this->hook_message($message);
262
 
263
  $network_display_name = $data->network_display_name;
302
 
303
  $content .= '<div class="pull-right hidden-xs b2s-post-item-info-area">';
304
 
305
+ if (in_array($data->networkId, $this->setPostFormat) || ($data->networkId == 19 && $data->networkType == 0)) {
306
  $postFormatType = ($data->networkId == 12) ? 'image' : 'post';
307
  $addCSS = (B2S_PLUGIN_USER_VERSION == 0) ? 'b2s-btn-disabled' : '';
308
  $content .= '<button class="btn btn-xs btn-link b2s-post-ship-item-post-format ' . $addCSS . '" data-post-wp-type="' . $this->b2sPostType . '" data-post-format-type="' . $postFormatType . '" data-network-auth-id="' . $data->networkAuthId . '" data-network-type="' . $data->networkType . '" data-network-id="' . $data->networkId . '" >' . __('post format', 'blog2social') . ': <span class="b2s-post-ship-item-post-format-text" data-post-format-type="' . $postFormatType . '" data-network-auth-id="' . $data->networkAuthId . '" data-network-type="' . $data->networkType . '" data-network-id="' . $data->networkId . '" ></span></button>';
309
  if (B2S_PLUGIN_USER_VERSION > 0) {
310
+ $content .= '<input type="hidden" class="b2s-post-item-details-post-format form-control" name="b2s[' . $data->networkAuthId . '][post_format]" data-network-auth-id="' . $data->networkAuthId . '" data-network-id="' . $data->networkId . '" data-network-type="' . $data->networkType . '" value="0" />';
311
  } else {
312
  $content .= '<span class="label label-success"><a target="_blank" class="btn-label-premium b2s-btn-trigger-post-ship-item-post-format" data-network-auth-id="' . $data->networkAuthId . '" href="#">PREMIUM</a></span>';
313
  }
314
  }
315
  $content .='<span class="b2s-post-tool-area" data-network-auth-id="' . $data->networkAuthId . '">';
316
+ $content .= (in_array($data->networkId, $this->setPostFormat) || ($data->networkId == 19 && $data->networkType == 0)) ? ' | ' : '';
317
  if (in_array($data->networkId, $this->getText)) {
318
  $content .= '<button class="btn btn-xs btn-link b2s-post-ship-item-full-text" data-network-id="' . $data->networkId . '" data-network-count="-1" data-network-auth-id="' . $data->networkAuthId . '" >' . __('Insert full-text', 'blog2social') . '</button> | ';
319
  }
380
  $content .= '<input type="hidden" class="form-control" name="b2s[' . $data->networkAuthId . '][network_tos_group_id]" value="' . $data->networkTosGroupId . '">';
381
  $content .= '<input type="hidden" class="form-control networkKind" data-network-auth-id="' . $data->networkAuthId . '" name="b2s[' . $data->networkAuthId . '][network_kind]" value="' . $data->networkKind . '">';
382
  $content .= '<input type="hidden" data-network-auth-id="' . $data->networkAuthId . '" class="form-control b2s-post-ship-network-display-name" name="b2s[' . $data->networkAuthId . '][network_display_name]" value="' . $data->network_display_name . '">';
383
+ $content .= '<input type="hidden" data-network-auth-id="' . $data->networkAuthId . '" class="b2s-network-default-image" value="' . $this->defaultImage . '">';
384
 
385
  $content .= '</div>';
386
  return $content;
481
  $edit = '<textarea class="form-control xing-textarea-input b2s-post-item-details-item-message-input ' . (in_array($networkId, $this->allowHtml) ? 'b2s-post-item-details-item-message-input-allow-html' : '') . '"data-network-count="-1" data-network-id="' . $networkId . '" data-network-text-limit="' . $limitValue . '" data-network-auth-id="' . $networkAuthId . '" placeholder="' . __('Write something about your post...', 'blog2social') . '" name="b2s[' . $networkAuthId . '][content]" ' . $isRequiredTextarea . ' ' . $textareaOnKeyUp . '>' . $message . '</textarea>';
482
  $edit .= '<div class="row">';
483
  $edit .= '<div class="' . ((isset($this->viewMode) && $this->viewMode == 'modal') ? 'col-xs-12' : 'col-xs-12 col-sm-5 col-lg-3') . '">';
484
+ $edit .= '<button class="btn btn-primary btn-circle b2s-image-remove-btn" data-network-count="-1" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" ' . ($imageUrl ? '' : 'style="display:none"') . '><i class="glyphicon glyphicon-trash"></i></button>';
485
+ $edit .= '<img src="' . (isset($meta['image']) && !empty($meta['image']) ? $meta['image'] : $this->defaultImage) . '" class="xing-url-image b2s-post-item-details-url-image center-block img-responsive" data-network-count="-1" data-network-id="' . $networkId . '" data-network-image-change="1" data-network-auth-id="' . $networkAuthId . '">';
486
  $edit .= '<input type="hidden" class="b2s-image-url-hidden-field form-control" data-network-count="-1" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" value="' . ($imageUrl ? $imageUrl : "") . '" name="b2s[' . $networkAuthId . '][image_url]">';
487
  $edit .= '<div class="clearfix"></div>';
488
+ $edit .= '<button class="btn btn-link btn-xs center-block b2s-select-image-modal-open" data-network-count="-1" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" data-post-id="' . $this->postId . '" data-image-url="' . esc_attr($imageUrl) . '">' . __('Change image', 'blog2social') . '</button>';
489
  $edit .= '</div>';
490
  $edit .= '<div class="' . ((isset($this->viewMode) && $this->viewMode == 'modal') ? 'col-xs-12"' : 'col-xs-12 col-sm-7 col-lg-9 b2s-post-original-area" data-network-auth-id="' . $networkAuthId . '"') . '>';
491
  $edit .= '<p class="xing-url-title b2s-post-item-details-preview-title hidden-xs" data-network-auth-id="' . $networkAuthId . '">' . (isset($meta['title']) && !empty($meta['title']) ? $meta['title'] : '') . '</p>';
563
  if (($networkId == 8 || $networkId == 19) && $networkType == 0) {
564
  $edit = '<div class="row"><br>';
565
  $edit .= '<div class="col-xs-12 col-sm-5 col-lg-3">';
566
+ $edit .= '<button class="btn btn-primary btn-circle b2s-image-remove-btn" data-network-count="' . $schedCount . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" ' . ($imageUrl ? '' : 'style="display:none"') . '><i class="glyphicon glyphicon-trash"></i></button>';
567
+ $edit .= '<img src="' . $this->defaultImage . '" class="xing-url-image b2s-post-item-details-url-image center-block img-responsive" data-network-count="' . $schedCount . '" data-network-id="' . $networkId . '" data-network-image-change="1" data-network-auth-id="' . $networkAuthId . '">';
568
  $edit .= '<input type="hidden" class="b2s-image-url-hidden-field form-control" data-network-count="' . $schedCount . '" data-network-count="' . $schedCount . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" value="' . ($imageUrl ? $imageUrl : "") . '" name="b2s[' . $networkAuthId . '][sched_image_url][' . $schedCount . ']">';
569
+ $edit .= '<div class="clearfix"></div>';
570
+ $edit .= '<button class="btn btn-link btn-xs center-block b2s-select-image-modal-open" data-network-count="' . $schedCount . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" data-post-id="' . $this->postId . '" data-image-url="' . esc_attr($imageUrl) . '">' . __('Change image', 'blog2social') . '</button>';
571
  $edit .= '</div>';
572
  $edit .= '<div class="col-xs-12 col-sm-7 col-lg-9">';
573
  $edit .= $infoArea;
741
 
742
  private function getRelayBtnHtml($networkAuthId, $networkId) {
743
  $relay = '<div class="form-group b2s-post-relay-area-select pull-left"><div class="checkbox checbox-switch switch-success"><label>';
744
+ $relay .='<input type="checkbox" class="b2s-post-item-details-relay form-control" data-user-version="' . B2S_PLUGIN_USER_VERSION . '" data-network-id="' . $networkId . '" data-network-auth-id="' . $networkAuthId . '" name="b2s[' . $networkAuthId . '][post_relay]" value="1"/>';
745
  $relay .='<span></span>';
746
  $relay .= __('Enable Retweets for all Tweets with the selected profile', 'blog2social') . ' <a href="#" data-toggle="modal" data-target="#b2sInfoPostRelayModal" class="btn-xs hidden-sm">' . __('Info', 'blog2social') . '</a>';
747
  $relay .=' </label></div></div>';
includes/B2S/Ship/Navbar.php CHANGED
@@ -4,6 +4,7 @@ class B2S_Ship_Navbar {
4
 
5
  private $neworkName;
6
  private $networkTypeName;
 
7
  private $networkKindName;
8
  private $authUrl;
9
  private $allowProfil;
@@ -21,6 +22,7 @@ class B2S_Ship_Navbar {
21
  $this->allowPage = unserialize(B2S_PLUGIN_NETWORK_ALLOW_PAGE);
22
  $this->allowGroup = unserialize(B2S_PLUGIN_NETWORK_ALLOW_GROUP);
23
  $this->oAuthPortal = unserialize(B2S_PLUGIN_NETWORK_OAUTH);
 
24
  }
25
 
26
  public function getData() {
@@ -42,22 +44,31 @@ class B2S_Ship_Navbar {
42
  return $select;
43
  }
44
 
45
- public function getItemHtml($data) {
46
  $username = stripslashes($data->networkUserName);
47
  $b2sAuthUrl = $this->authUrl . '&portal_id=' . $data->networkId . '&transfer=' . (in_array($data->networkId, $this->oAuthPortal) ? 'oauth' : 'form' ) . '&mandant_id=' . $data->mandantId . '&version=3&affiliate_id='.B2S_Tools::getAffiliateId();
48
- $onclick = ($data->expiredDate != '0000-00-00' && $data->expiredDate <= date('Y-m-d')) ? ' onclick="wop(\'' . $b2sAuthUrl . '&choose=profil&update=' . $data->networkAuthId . '\', \'Blog2Social Network\'); return false;"' : '';
49
-
50
- global $wpdb;
51
- $mandantCount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(mandant_id)FROM b2s_user_network_settings WHERE mandant_id =%d AND blog_user_id=%d ", $data->mandantId, B2S_PLUGIN_BLOG_USER_ID));
52
- $userSelected = $wpdb->get_results($wpdb->prepare("SELECT mandant_id FROM b2s_user_network_settings WHERE blog_user_id =%d AND network_auth_id = %d", B2S_PLUGIN_BLOG_USER_ID, $data->networkAuthId));
53
 
54
  $mandantIds = array();
55
- foreach ($userSelected as $key => $value) {
56
- $mandantIds[] = $value->mandant_id;
57
- }
 
 
 
 
 
58
 
59
- if ($mandantCount == 0) {
60
- $mandantIds[] = $data->mandantId;
 
 
 
 
 
61
  }
62
  //Bug: Converting json + PHP Extension
63
  if (function_exists('mb_strlen') && function_exists('mb_substr')) {
4
 
5
  private $neworkName;
6
  private $networkTypeName;
7
+ private $networkTypeData;
8
  private $networkKindName;
9
  private $authUrl;
10
  private $allowProfil;
22
  $this->allowPage = unserialize(B2S_PLUGIN_NETWORK_ALLOW_PAGE);
23
  $this->allowGroup = unserialize(B2S_PLUGIN_NETWORK_ALLOW_GROUP);
24
  $this->oAuthPortal = unserialize(B2S_PLUGIN_NETWORK_OAUTH);
25
+ $this->networkTypeData=array('profile','page', 'group');
26
  }
27
 
28
  public function getData() {
44
  return $select;
45
  }
46
 
47
+ public function getItemHtml($data, $draftData = array()) {
48
  $username = stripslashes($data->networkUserName);
49
  $b2sAuthUrl = $this->authUrl . '&portal_id=' . $data->networkId . '&transfer=' . (in_array($data->networkId, $this->oAuthPortal) ? 'oauth' : 'form' ) . '&mandant_id=' . $data->mandantId . '&version=3&affiliate_id='.B2S_Tools::getAffiliateId();
50
+
51
+ $chooseData = isset($this->networkTypeData[$data->networkType]) ? $this->networkTypeData[$data->networkType] : 'profile';
52
+
53
+ $onclick = ($data->expiredDate != '0000-00-00' && $data->expiredDate <= date('Y-m-d')) ? ' onclick="wop(\'' . $b2sAuthUrl . '&choose='.$chooseData.'&update=' . $data->networkAuthId . '\', \'Blog2Social Network\'); return false;"' : '';
 
54
 
55
  $mandantIds = array();
56
+ if(empty($draftData)){
57
+ global $wpdb;
58
+ $mandantCount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(mandant_id)FROM b2s_user_network_settings WHERE mandant_id =%d AND blog_user_id=%d ", $data->mandantId, B2S_PLUGIN_BLOG_USER_ID));
59
+ $userSelected = $wpdb->get_results($wpdb->prepare("SELECT mandant_id FROM b2s_user_network_settings WHERE blog_user_id =%d AND network_auth_id = %d", B2S_PLUGIN_BLOG_USER_ID, $data->networkAuthId));
60
+
61
+ foreach ($userSelected as $key => $value) {
62
+ $mandantIds[] = $value->mandant_id;
63
+ }
64
 
65
+ if ($mandantCount == 0) {
66
+ $mandantIds[] = $data->mandantId;
67
+ }
68
+ } else {
69
+ if (array_key_exists($data->networkAuthId, $draftData['b2s'])){
70
+ $mandantIds[] = "0";
71
+ }
72
  }
73
  //Bug: Converting json + PHP Extension
74
  if (function_exists('mb_strlen') && function_exists('mb_substr')) {
includes/Loader.php CHANGED
@@ -1,1511 +1,1549 @@
1
- <?php
2
-
3
- class B2S_Loader {
4
-
5
- public $blogUserData;
6
- public $lastVersion;
7
-
8
- public function __construct() {
9
-
10
- }
11
-
12
- public function load() {
13
- if (!is_admin()) {
14
- $this->call_public_hooks();
15
- }
16
- $this->call_global_hooks();
17
- if (is_admin()) {
18
- $this->call_admin_hooks();
19
- }
20
- }
21
-
22
- public function call_global_hooks() {
23
-
24
- $this->b2s_register_custom_post_type();
25
-
26
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
27
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
28
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
29
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Heartbeat.php');
30
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Post.php');
31
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Get.php');
32
- require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
33
- require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
34
-
35
- define('B2S_PLUGIN_POSTPERPAGE', '15');
36
- define('B2S_PLUGIN_VERSION_TYPE', serialize(array(0 => 'Free', 1 => 'Smart', 2 => 'Pro', 3 => 'Business', 4 => 'Premium')));
37
- define('B2S_PLUGIN_NETWORK', serialize(array(1 => 'Facebook', 2 => 'Twitter', 3 => 'Linkedin', 4 => 'Tumblr', 5 => 'Storify', 6 => 'Pinterest', 7 => 'Flickr', 8 => 'Xing', 9 => 'Diigo', 10 => 'Google+', 11 => 'Medium', 12 => 'Instagram', 13 => 'Delicious', 14 => 'Torial', 15 => 'Reddit', 16 => 'Bloglovin', 17 => 'VKontakte', 18 => 'Google My Business', 19 => 'Xing', 20 => 'Pinterest')));
38
- define('B2S_PLUGIN_SCHED_DEFAULT_TIMES', serialize(array(1 => array(18, 22), 2 => array(8, 10), 3 => array(8, 10), 4 => array(16, 22), 5 => array(), 6 => array(19, 22), 7 => array(7, 9), 8 => array(7, 10), 9 => array(16, 19), 10 => array(7, 10), 11 => array(16, 19), 12 => array(19, 22), 13 => array(11, 13), 14 => array(18, 22), 15 => array(8, 11), 16 => array(16, 19), 17 => array(19, 23), 18 => array(17, 18), 19 => array(7, 10))));
39
- define('B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO', serialize(array(1 => array(0 => array(13, 16), 1 => array(18, 22)), 2 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 3 => array(0 => array(8, 10), 1 => array(16, 18)), 4 => array(), 5 => array(), 6 => array(0 => array(12, 14), 1 => array(19, 22)), 7 => array(0 => array(7, 9), 1 => array(17, 19)), 8 => array(0 => array(7, 10), 1 => array(17, 18)), 9 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 10 => array(0 => array(7, 10), 1 => array(14, 15)), 11 => array(), 12 => array(0 => array(12, 14), 1 => array(19, 22)), 13 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 14 => array(), 15 => array(0 => array(8, 11)), 16 => array(0 => array(16, 19)), 17 => array(0 => array(19, 23)), 18 => array(0 => array(17, 18)), 19 => array(0 => array(7, 10), 1 => array(17, 18)), 20 => array(0 => array(12, 14), 1 => array(19, 22)))));
40
- define('B2S_PLUGIN_NETWORK_ALLOW_PROFILE', serialize(array(1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
41
- define('B2S_PLUGIN_NETWORK_ALLOW_PAGE', serialize(array(1, 3, 10, 17, 19)));
42
- define('B2S_PLUGIN_NETWORK_ALLOW_GROUP', serialize(array(1, 10, 11, 17, 19)));
43
- define('B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT', serialize(array(19 => array(2 => 3)))); //2=group
44
- define('B2S_PLUGIN_NETWORK_ALLOW_MODIFY_BOARD_AND_GROUP', serialize(array(6 => array('TYPE' => array(0), 'TITLE' => __('Modify pin board', 'blog2social')), 8 => array('TYPE' => array(2), 'TITLE' => __('Edit group settings', 'blog2social')), 15 => array('TYPE' => array(0), 'TITLE' => __('Modify subreddit', 'blog2social')), 19 => array('TYPE' => array(2), 'TITLE' => __('Modify forum', 'blog2social')), 20 => array('TYPE' => array(0), 'TITLE' => __('Modify pin board', 'blog2social')))));
45
- define('B2S_PLUGIN_AUTO_POST_LIMIT', serialize(array(0 => 0, 1 => 25, 2 => 50, 3 => 100, 4 => 100)));
46
- define('B2S_PLUGIN_NETWORK_OAUTH', serialize(array(1, 2, 3, 4, 7, 8, 11, 15, 17, 18, 20)));
47
- define('B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT', serialize(array(
48
- 1 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 500), 'content' => '{CONTENT}', 'format' => 0),
49
- 1 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => '{CONTENT}', 'format' => 0),
50
- 2 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => '{CONTENT}', 'format' => 0)
51
- ),
52
- 2 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 255, 'range_max' => 256, 'excerpt_range_min' => 255, 'excerpt_range_max' => 256, 'limit' => 280), 'content' => '{CONTENT}', 'format' => 1)),
53
- 3 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 1300), 'content' => '{CONTENT}', 'format' => 0),
54
- 1 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 1300), 'content' => '{CONTENT}', 'format' => 0),
55
- ),
56
- 12 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 240, 'range_max' => 400, 'excerpt_range_min' => 240, 'excerpt_range_max' => 400, 'limit' => 2000), 'content' => '{CONTENT}', 'format' => 1))
57
- )));
58
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_WORDPRESSVERSION', '4.4.2');
59
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPVERSION', '5.5.3');
60
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_MYSQLVERSION', '5.5.3');
61
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_DATABASERIGHTS', true);
62
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_HEARTBEAT', true);
63
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPCURL', true);
64
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPDOM', true);
65
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_HOTLINKPROTECTION', true);
66
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_PLUGINWARNING_WORDS', serialize(array('hotlink', 'firewall', 'security', 'heartbeat')));
67
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_WPJSON', true);
68
- define('B2S_PLUGIN_SYSTEMREQUIREMENT_OPENSSL', true);
69
- define('B2S_PLUGIN_PAGE_SLUG', serialize(array('blog2social', 'blog2social-post', 'blog2social-calendar', 'blog2social-curation', 'blog2social-network', 'blog2social-settings', 'prg-post', 'blog2social-support', 'blog2social-premium', 'blog2social-sched', 'blog2social-approve', 'blog2social-publish', 'blog2social-notice', 'blog2social-ship', 'blog2social-curation-draft', 'prg-login', 'prg-ship')));
70
-
71
- add_filter('heartbeat_received', array(B2S_Heartbeat::getInstance(), 'init'), 10, 2);
72
- add_action('wp_logout', array($this, 'releaseLocks'));
73
- add_action('transition_post_status', array($this, 'b2s_auto_post_import'), 9999, 3); //for Auto-Posting imported + manuell
74
- add_action('rest_api_init', array($this, 'b2s_rest_api_init'));
75
- }
76
-
77
- public function call_admin_hooks() {
78
-
79
- require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
80
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/PostBox.php');
81
- require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
82
- require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Post.php');
83
- require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Get.php');
84
- require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Post.php');
85
- require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Get.php');
86
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
87
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
88
- require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
89
- require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
90
-
91
- define('B2S_PLUGIN_BLOG_USER_ID', get_current_user_id());
92
- define('B2S_PLUGIN_ADMIN', current_user_can('edit_others_posts'));
93
-
94
- $this->blogUserData = get_userdata(B2S_PLUGIN_BLOG_USER_ID);
95
-
96
- //deactivated since 4.2.0
97
- //add_action('plugins_loaded', array($this, 'update_db_check'));
98
-
99
- $this->update_db_check();
100
-
101
- add_action('admin_init', array($this, 'registerAssets'));
102
- add_action('admin_enqueue_scripts', array($this, 'addBootAssets'));
103
- add_action('admin_menu', array($this, 'createMenu'));
104
- add_action('admin_bar_menu', array($this, 'createToolbarMenu'), 94);
105
- add_action('admin_notices', array('B2S_Notice', 'getProVersionNotice'));
106
- add_action('admin_notices', array($this, 'b2s_save_post_alert_meta_box'));
107
- add_action('add_meta_boxes', array($this, 'b2s_load_post_box'));
108
- add_action('save_post', array($this, 'b2s_save_post_box'), 1, 3);
109
- add_action('trash_post', array($this, 'b2s_delete_sched_post'), 10);
110
-
111
- add_action('admin_footer', array($this, 'plugin_deactivate_add_modal'));
112
- add_filter('plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'override_plugin_action_links'));
113
-
114
- Ajax_Get::getInstance();
115
- Ajax_Post::getInstance();
116
-
117
- if ((int) B2S_PLUGIN_BLOG_USER_ID > 0) {
118
- $this->getToken();
119
- $this->getUserDetails();
120
- }
121
- $this->plugin_init_language();
122
- }
123
-
124
- public function call_public_hooks() {
125
- add_filter('wp_footer', array($this, 'b2s_get_full_content'), 99); //for shortcodes
126
- add_action('wp_head', array($this, 'b2s_build_frontend_meta'), 1); // for MetaTags
127
- }
128
-
129
- public function b2s_build_frontend_meta() {
130
- require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
131
- B2S_Meta::getInstance()->_run();
132
- }
133
-
134
- public function b2s_rest_api_init() {
135
- register_rest_route('blog2social/v1/post', '/authorize', array(
136
- 'methods' => WP_REST_Server::CREATABLE,
137
- 'callback' => array($this, 'b2s_rest_api_post_authorize')
138
- ));
139
- }
140
-
141
- public function b2s_rest_api_post_authorize($post = array()) {
142
- $contentType = 'application/json';
143
- if (isset($post['token']) && !empty($post['token']) && isset($post['user']) && !empty($post['user']) && isset($post['network_id']) && (int) $post['network_id'] > 0) {
144
- $privateKey = B2S_PLUGIN_DIR . '/includes/B2S/Api/Network/private_key.pem';
145
- if (function_exists('openssl_public_decrypt') && file_exists($privateKey)) {
146
- if ((int) $post['network_id'] == 6) {
147
- try {
148
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
149
- $user = '';
150
- $pass = '';
151
- $getPrivateKey = file_get_contents($privateKey);
152
- openssl_private_decrypt(base64_decode(trim($post['user']['pass'])), $pass, $getPrivateKey);
153
- openssl_private_decrypt(base64_decode(trim($post['user']['name'])), $user, $getPrivateKey);
154
- $pt = new B2S_Api_Network_Pinterest();
155
- $result = $pt->authorize($user, $pass);
156
- $status = isset($result['cookie_data']) && !empty($result['cookie_data']) ? 200 : 400;
157
- $response = array('code' => $status, 'result' => array_merge($result, array('token' => $post['token'], 'network_id' => (int) $post['network_id'])));
158
- return new WP_REST_Response($response, $status, array('Content-Type: ' . $contentType));
159
- } catch (Exception $ex) {
160
- $response = array('code' => 500, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 8, 'error_data' => serialize($ex->getMessage())));
161
- return new WP_REST_Response($response, 500, array('Content-Type: ' . $contentType));
162
- }
163
- }
164
- $response = array('code' => 409, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'network_not_exists'));
165
- return new WP_REST_Response($response, 409, array('Content-Type: ' . $contentType));
166
- }
167
- $response = array('code' => 501, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'openssl_not_exists'));
168
- return new WP_REST_Response($response, 501, array('Content-Type: ' . $contentType));
169
- }
170
- $response = array('code' => 502, 'result' => array('error' => 1, 'error_pos' => 10, 'error_data' => 'bad_request'));
171
- return new WP_REST_Response($response, 502, array('Content-Type: ' . $contentType));
172
- }
173
-
174
- private function b2s_register_custom_post_type() {
175
- if (post_type_exists("b2s_ex_post")) {
176
- return;
177
- }
178
- register_post_type('b2s_ex_post', array('public' => false, 'label' => 'Related Posts for Blog2Social'));
179
- }
180
-
181
- public function plugin_deactivate_add_modal() {
182
- include_once(B2S_PLUGIN_DIR . '/views/b2s/partials/plugin-deactivate-modal.php');
183
- }
184
-
185
- public function b2s_auto_post_import($new_status, $old_status, $post) {
186
-
187
- //is first publish
188
- if ($old_status != 'publish' && $old_status != 'trash' && $new_status == 'publish' && isset($post->post_author) && (int) $post->post_author > 0) {
189
- if (wp_is_post_revision($post->ID)) {
190
- return;
191
- }
192
- //is lock if manuell Auto-Posting in form
193
- $isLock = get_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
194
- if ($isLock === false) {
195
- $options = new B2S_Options((int) $post->post_author);
196
- $autoPostData = $options->_getOption('auto_post_import');
197
- if ($autoPostData !== false && is_array($autoPostData)) {
198
- if (isset($autoPostData['active']) && (int) $autoPostData['active'] == 1) {
199
-
200
- //Premium
201
- $tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . (int) $post->post_author);
202
- if ($tokenInfo !== false && isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'] >= 1) {
203
- $filter = true;
204
- if (isset($autoPostData['post_filter']) && (int) $autoPostData['post_filter'] == 1) {
205
- if (isset($autoPostData['post_type']) && is_array($autoPostData['post_type']) && !empty($autoPostData['post_type'])) {
206
- if (isset($autoPostData['post_type_state']) && (int) $autoPostData['post_type_state'] == 0) { //include
207
- if (!in_array($post->post_type, $autoPostData['post_type'])) {
208
- $filter = false;
209
- }
210
- } else { //exclude
211
- if (in_array($post->post_type, $autoPostData['post_type'])) {
212
- $filter = false;
213
- }
214
- }
215
- }
216
- }
217
- if ($filter && isset($autoPostData['network_auth_id']) && !empty($autoPostData['network_auth_id']) && is_array($autoPostData['network_auth_id'])) {
218
- //LIMIT
219
- $limit = false;
220
- $ship = false;
221
- $optionUserTimeZone = $options->_getOption('user_time_zone');
222
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
223
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
224
- $current_utc_datetime = gmdate('Y-m-d H:i:s');
225
- $current_user_date = date('Y-m-d', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
226
-
227
- $autoPostCon = $options->_getOption('auto_post_import_condition');
228
- $conData = array();
229
- if ($autoPostCon !== false && is_array($autoPostCon) && isset($autoPostCon['count']) && isset($autoPostCon['last_call_date'])) {
230
- $con = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
231
- $userVersion = (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'];
232
- $limitCount = (isset($con[$userVersion]) && !empty($con[$userVersion])) ? $con[$userVersion] : $con[1]; //25 default
233
- if (($autoPostCon['count'] < $limitCount) || ($current_user_date != $autoPostCon['last_call_date'])) {
234
- $limit = true;
235
- $count = ($current_user_date != $autoPostCon['last_call_date']) ? 1 : $autoPostCon['count'] + 1;
236
- $conData = array('count' => $count, 'last_call_date' => $current_user_date);
237
- }
238
- } else {
239
- $limit = true;
240
- $conData = array('count' => 1, 'last_call_date' => $current_user_date);
241
- }
242
- if (!empty($conData)) {
243
- $options->_setOption('auto_post_import_condition', $conData);
244
- }
245
-
246
- if ($limit) {
247
- global $wpdb;
248
- $optionPostFormat = $options->_getOption('post_template');
249
- $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $post->ID));
250
- //WooCommerce keyword support
251
- if ($post->post_type == 'product' && taxonomy_exists('product_tag')) {
252
- $keywords = wp_get_post_terms((int) $post->ID, 'product_tag');
253
- } else {
254
- $keywords = wp_get_post_tags((int) $post->ID);
255
- }
256
- $url = get_permalink($post->ID);
257
- $title = isset($post->post_title) ? B2S_Util::getTitleByLanguage(strip_tags($post->post_title)) : '';
258
- $content = (isset($post->post_content) && !empty($post->post_content)) ? trim($post->post_content) : '';
259
- $excerpt = (isset($post->post_excerpt) && !empty($post->post_excerpt)) ? trim($post->post_excerpt) : '';
260
- $delay = (isset($autoPostData['ship_state']) && (int) $autoPostData['ship_state'] = 0) ? 0 : (isset($autoPostData['ship_delay_time']) ? (int) $autoPostData['ship_delay_time'] : 0);
261
- $current_user_datetime = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
262
-
263
- //ShareNow
264
- $sched_type = 3;
265
- $time = ($delay == 0) ? "-30 seconds" : "+" . $delay . " minutes";
266
- $sched_date = date('Y-m-d H:i:s', strtotime($time, strtotime($current_user_datetime)));
267
- $sched_date_utc = date('Y-m-d H:i:s', strtotime($time, strtotime($current_user_datetime)));
268
-
269
- $optionNoCache = $options->_getOption('link_no_cache');
270
- $optionUserHashTag = $options->_getOption('user_allow_hashtag');
271
- $allowHashTag = ($optionUserHashTag === false || $optionUserHashTag == 1) ? true : false;
272
-
273
- $defaultPostData = array('default_titel' => $title,
274
- 'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
275
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
276
- 'no_cache' => (($optionNoCache === false || $optionNoCache == 0) ? 0 : 1), //default inactive , 1=active 0=not
277
- 'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $userTimeZoneOffset);
278
-
279
- $defaultBlogPostData = array('post_id' => (int) $post->ID, 'blog_user_id' => (int) $post->post_author, 'user_timezone' => $userTimeZoneOffset, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
280
-
281
- $autoShare = new B2S_AutoPost((int) $post->ID, $defaultBlogPostData, $current_user_date, false, $title, $content, $excerpt, $url, $image_url, $keywords, trim(strtolower(substr(B2S_LANGUAGE, 0, 2))), $optionPostFormat, $allowHashTag);
282
-
283
- //TOS Twitter 032018 - none multiple Accounts - User select once
284
- $networkTos = true;
285
-
286
- foreach ($autoPostData['network_auth_id'] as $k => $value) {
287
- $networkDetails = $wpdb->get_results($wpdb->prepare("SELECT postNetworkDetails.network_id, postNetworkDetails.network_type, postNetworkDetails.network_display_name FROM b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $value));
288
- if (is_array($networkDetails) && isset($networkDetails[0]->network_id) && isset($networkDetails[0]->network_type) && isset($networkDetails[0]->network_display_name)) {
289
-
290
- //TOS Twitter 032018 - none multiple Accounts - User select once
291
- if ((int) $networkDetails[0]->network_id != 2 || ( (int) $networkDetails[0]->network_id == 2 && $networkTos)) {
292
- //at first: set one profile
293
- if ((int) $networkDetails[0]->network_id == 2) {
294
- $networkTos = false;
295
- }
296
- $res = $autoShare->prepareShareData($value, $networkDetails[0]->network_id, $networkDetails[0]->network_type);
297
- if ($res !== false && is_array($res)) {
298
- $ship = true;
299
- $res = array_merge($res, $defaultPostData);
300
- $autoShare->saveShareData($res, $networkDetails[0]->network_id, $networkDetails[0]->network_type, $value, 0, strip_tags($networkDetails[0]->network_display_name));
301
- }
302
- }
303
- }
304
- }
305
- if ($ship) {
306
- B2S_Heartbeat::getInstance()->postToServer();
307
- }
308
- }
309
- }
310
- }
311
- }
312
- }
313
- } else {
314
- //Unlock Auto-Post-Import
315
- delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
316
- }
317
- }
318
- }
319
-
320
- public function update_db_check() {
321
- $this->lastVersion = get_option('b2s_plugin_version');
322
- if ($this->lastVersion == false || (int) $this->lastVersion < B2S_PLUGIN_VERSION) {
323
- $this->activatePlugin();
324
- update_option('b2s_plugin_version', B2S_PLUGIN_VERSION, false);
325
- }
326
- }
327
-
328
- public function b2s_delete_sched_post($post_id) {
329
- wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
330
- if ((int) $post_id > 0) {
331
- global $wpdb;
332
- //Heartbeat => b2s_delete_sched_post
333
- $sql = "SELECT id, post_for_approve FROM b2s_posts WHERE post_id = %d AND hook_action <= %d AND hide = %d AND sched_date_utc != %s AND publish_date = %s";
334
- $deleteData = $wpdb->get_results($wpdb->prepare($sql, $post_id, 2, 0, "0000-00-00 00:00:00", "0000-00-00 00:00:00"), ARRAY_A);
335
- if (is_array($deleteData) && !empty($deleteData) && isset($deleteData[0])) {
336
- foreach ($deleteData as $k => $value) {
337
- if ((int) $value['id'] > 0) {
338
- if ((int) $value['post_for_approve'] == 1) {
339
- $data = array('hook_action' => '0', 'hide' => 1);
340
- } else {
341
- $data = array('hook_action' => '3', 'hide' => 1);
342
- }
343
- $where = array('id' => (int) $value['id']);
344
- $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
345
- }
346
- }
347
- }
348
- }
349
- }
350
-
351
- public function b2s_get_full_content() {
352
- if (isset($_GET['b2s_get_full_content'])) {
353
- $b2sPostContent = do_shortcode(get_the_content());
354
- $b2sPostId = get_the_ID();
355
- update_option('B2S_PLUGIN_POST_CONTENT_' . $b2sPostId, $b2sPostContent, false);
356
- }
357
- }
358
-
359
- public function b2s_load_post_box() {
360
- if (defined("B2S_PLUGIN_TOKEN")) {
361
- $post_types = get_post_types(array('public' => true));
362
- if (is_array($post_types) && !empty($post_types)) {
363
- foreach ($post_types as $post_type) {
364
- add_meta_box('b2s-post-meta-box-auto', '<span style="padding: 10px 0 10px 25px; background: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\') no-repeat left center;"></span>' . __('Auto-Post on Social Media', 'blog2social'), array($this, 'b2s_view_post_box'), $post_type, 'side', 'high');
365
- add_meta_box('b2s-post-box-calendar-header', '<span style="padding: 10px 0 10px 25px; background: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\') no-repeat left center;"></span>' . __('Social Media Content Calendar', 'blog2social'), array($this, 'b2s_view_post_box_calendar'), $post_type, 'normal', 'high');
366
- }
367
- }
368
- }
369
- }
370
-
371
- public function b2s_view_post_box() {
372
- wp_enqueue_style('B2SAIRDATEPICKERCSS');
373
- wp_enqueue_style('B2SPOSTBOXCSS');
374
- wp_enqueue_script('B2SAIRDATEPICKERJS');
375
- wp_enqueue_script('B2SAIRDATEPICKERDEJS');
376
- wp_enqueue_script('B2SAIRDATEPICKERENJS');
377
- wp_enqueue_script('B2SPOSTBOXJS');
378
-
379
- wp_nonce_field("b2s-meta-box-nonce-post-area", "b2s-meta-box-nonce");
380
- $postId = (isset($_GET['post']) && (int) $_GET['post'] > 0) ? (int) $_GET['post'] : 0;
381
- $postType = (isset($_GET['post_type']) && !empty($_GET['post_type'])) ? $_GET['post_type'] : get_post_type($postId);
382
- $postStatus = ($postId != 0) ? get_post_status($postId) : '';
383
- $postBox = new B2S_PostBox();
384
- echo $postBox->getPostBox($postId, $postType, $postStatus);
385
- }
386
-
387
- public function b2s_view_post_box_calendar() {
388
- wp_enqueue_style('B2SFULLCALLENDARCSS');
389
- wp_enqueue_style('B2SCALENDARCSS');
390
- wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
391
- wp_enqueue_script('B2SFULLCALENDARJS');
392
- wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
393
- wp_enqueue_script('B2SLIB');
394
- echo '<div class="b2s-post-box-calendar-content"></div>';
395
- }
396
-
397
- public function b2s_save_post_box() {
398
-
399
- if (!isset($_POST['wphb-clear-cache'])) { // WP-Hummingbird BTN clear cache - protection
400
- if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
401
- if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
402
- //Gutenberg WP V5.0 - B2S V5.1.0 optimization
403
- if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
404
- $content = get_post((int) $_POST['post_ID']);
405
- if (!isset($_POST['post_title'])) {
406
- $_POST['post_title'] = $content->post_title;
407
- }
408
- if (!isset($_POST['content'])) {
409
- $_POST['content'] = $content->post_content;
410
- }
411
- }
412
-
413
- $b2sPostLang = (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) ? $_POST['b2s-user-lang'] : 'en';
414
- //OgMeta
415
- if (isset($_POST['isOgMetaChecked']) && (int) $_POST['isOgMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
416
- $meta = B2S_Meta::getInstance();
417
- $meta->getMeta(((int) $_POST['post_ID']));
418
- $title = B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang));
419
- if (has_excerpt((int) $_POST['post_ID'])) {
420
- $desc = strip_tags(get_the_excerpt());
421
- } else {
422
- $desc = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($_POST['content'])), 0, 160));
423
- }
424
- $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
425
- $meta->setMeta('og_title', $title);
426
- $meta->setMeta('og_desc', $desc);
427
- $meta->setMeta('og_image', (($image_url !== false) ? trim(urldecode($image_url)) : ''));
428
- $meta->updateMeta((int) $_POST['post_ID']);
429
- }
430
-
431
- //CardMeta
432
- if (isset($_POST['isCardMetaChecked']) && (int) $_POST['isCardMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
433
- $meta = B2S_Meta::getInstance();
434
- $meta->getMeta(((int) $_POST['post_ID']));
435
- $title = B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang));
436
- if (has_excerpt((int) $_POST['post_ID'])) {
437
- $desc = strip_tags(get_the_excerpt());
438
- } else {
439
- $desc = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($_POST['content'])), 0, 160));
440
- }
441
- $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
442
- $meta->setMeta('card_title', $title);
443
- $meta->setMeta('card_desc', $desc);
444
- $meta->setMeta('card_image', (($image_url !== false) ? trim(urldecode($image_url)) : ''));
445
- $meta->updateMeta((int) $_POST['post_ID']);
446
- }
447
-
448
- 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'])) {
449
- if (strtolower($_POST['b2s-post-meta-box-time-dropdown']) == 'publish') {
450
- if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
451
- $profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
452
- if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
453
- $networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
454
- if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
455
- $user_timezone = isset($_POST['b2s-user-timezone']) ? $_POST['b2s-user-timezone'] : 0;
456
- $current_utc_date = gmdate('Y-m-d H:i:s');
457
- $current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
458
-
459
- //WP User Sched Post + B2S Share NOW FRIST SAVE
460
- $post_date = '';
461
- if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
462
- $post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
463
- }
464
-
465
- //WP User Sched Post + B2S Share NOW SECOND SAVE
466
- if (empty($post_date) && strtolower($_POST['post_status']) == "future") {
467
- if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
468
- $wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
469
- } else {
470
- //V5.0.0 Gutenberg Editor
471
- $wp_user_sched_post_date = get_the_date('Y-m-d H:i:s', $_POST['post_ID']);
472
- }
473
- $post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
474
- }
475
-
476
- //ShareNow
477
- $sched_type = 3;
478
- $sched_date = $current_user_date;
479
- $sched_date_utc = date('Y-m-d H:i:s', strtotime("-30 seconds", strtotime($current_utc_date)));
480
- $myTimeSettings = false;
481
-
482
- //allow for User Post Date (Schedule)
483
- if (!empty($post_date) && $current_user_date <= $post_date) {
484
- $sched_type = 2;
485
-
486
- if (date('i', strtotime($post_date)) <= 30) {
487
- $sched_date = date('Y-m-d H:30:00', strtotime($post_date));
488
- } else {
489
- $sched_date = date('Y-m-d H:00:00', strtotime('+1 hours', strtotime($post_date)));
490
- }
491
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
492
- }
493
-
494
- //Schedule post once
495
- if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 1) {
496
- $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'));
497
- //Check User Schedule Date in past!
498
- if ($user_sched_date >= $sched_date) {
499
- $sched_type = 2;
500
- $sched_date = $user_sched_date;
501
- $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
502
- }
503
- } else if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 2) {
504
- //allow for my Time Settings
505
- if (isset($_POST['b2s-post-meta-box-best-time-settings'])) {
506
- $sched_type = 2;
507
- $myTimeSettings = unserialize(stripslashes($_POST['b2s-post-meta-box-best-time-settings']));
508
- if ($myTimeSettings !== false && is_array($myTimeSettings) && isset($myTimeSettings['times']) && isset($myTimeSettings['type'])) {
509
- $myTimeSettings = $myTimeSettings;
510
- }
511
- }
512
- }
513
-
514
- delete_option('B2S_PLUGIN_POST_CONTENT_' . (int) $_POST['post_ID']);
515
- $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
516
- //WooCommerce keyword support
517
- if (get_post_type((int) $_POST['post_ID']) == 'product' && taxonomy_exists('product_tag')) {
518
- $keywords = get_the_terms((int) $_POST['post_ID'], 'product_tag');
519
- } else {
520
- $keywords = get_the_tags((int) $_POST['post_ID']);
521
- }
522
- $url = get_permalink($_POST['post_ID']);
523
- $title = isset($_POST['post_title']) ? B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang)) : '';
524
- $content = (isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : '';
525
- $excerpt = (isset($_POST['post_excerpt']) && !empty($_POST['post_excerpt'])) ? trim($_POST['post_excerpt']) : '';
526
-
527
- $options = new B2S_Options((int) $_POST['user_ID']);
528
- $optionPostFormat = $options->_getOption('post_template');
529
- $optionNoCache = $options->_getOption('link_no_cache');
530
- $optionUserHashTag = $options->_getOption('user_allow_hashtag');
531
- $allowHashTag = ($optionUserHashTag === false || $optionUserHashTag == 1) ? true : false;
532
-
533
- $defaultPostData = array('default_titel' => $title,
534
- 'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
535
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
536
- 'no_cache' => (($optionNoCache === false || $optionNoCache == 0) ? 0 : 1), //default inactive , 1=active 0=not
537
- 'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $user_timezone); // 'publish_date' => $sched_date, OLD FOR Share Now?
538
-
539
- $defaultBlogPostData = array('post_id' => (int) $_POST['post_ID'], 'blog_user_id' => (int) $_POST['user_ID'], 'user_timezone' => $user_timezone, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
540
-
541
- $autoShare = new B2S_AutoPost((int) $_POST['post_ID'], $defaultBlogPostData, $current_user_date, $myTimeSettings, $title, $content, $excerpt, $url, $image_url, $keywords, $b2sPostLang, $optionPostFormat, $allowHashTag);
542
- define('B2S_SAVE_META_BOX_AUTO_SHARE', $_POST['post_ID']);
543
- if (isset($_POST['b2s-user-last-selected-profile-id']) && (int) $_POST['b2s-user-last-selected-profile-id'] != (int) $_POST['b2s-post-meta-box-profil-dropdown'] && (int) $_POST['b2s-post-meta-box-profil-dropdown'] != 0) {
544
- update_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . $_POST['user_ID'], (int) $_POST['b2s-post-meta-box-profil-dropdown'], false);
545
- }
546
-
547
- $metaOg = false;
548
- $metaCard = false;
549
- $tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
550
-
551
-
552
- //>V5.6.0 Scheduling lookup existing posts - delete entries (hook_action) - merge with current networkData & insert
553
- if ($sched_type == 2) {
554
- global $wpdb;
555
- $getSchedData = $wpdb->prepare("SELECT b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM b2s_posts b LEFT JOIN b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 2, "0000-00-00 00:00:00", 0);
556
- $schedDataResult = $wpdb->get_results($getSchedData);
557
- $delete_scheds = array();
558
- foreach ($schedDataResult as $k => $value) {
559
- $isNew = true;
560
- foreach ($networkData as $j => $currvalue) {
561
- if ($value->networkAuthId == $currvalue->networkAuthId) {
562
- $isNew = false;
563
- }
564
- }
565
- if ($isNew) {
566
- array_push($networkData, $value);
567
- }
568
- array_push($delete_scheds, $value->b2sPostId);
569
- }
570
- if (!empty($delete_scheds)) {
571
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
572
- B2S_Post_Tools::deleteUserSchedPost($delete_scheds);
573
- }
574
- }
575
-
576
-
577
- //TOS Twitter 032018 - none multiple Accounts - User select once
578
- $selectedTwitterProfile = (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && !empty($_POST['b2s-post-meta-box-profil-dropdown-twitter'])) ? (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] : '';
579
- foreach ($networkData as $k => $value) {
580
- if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
581
- //TOS Twitter 032018 - none multiple Accounts - User select once
582
- if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
583
-
584
- //TOS Crossposting ignore
585
- //Filter: TOS Crossposting ignore
586
- if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
587
- continue;
588
- }
589
-
590
- $res = $autoShare->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType);
591
- if ($res !== false && is_array($res)) {
592
- $res = array_merge($res, $defaultPostData);
593
- $shareApprove = (isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0;
594
- $autoShare->saveShareData($res, $value->networkId, $value->networkType, $value->networkAuthId, $shareApprove, strip_tags($value->networkUserName));
595
-
596
- //Start - Change/Set MetaTags
597
- //TODO Check Enable Feature
598
- if ((int) $value->networkId == 1 && $metaOg == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
599
- $metaOg = true;
600
- $meta = B2S_Meta::getInstance();
601
- $meta->getMeta((int) $_POST['post_ID']);
602
- if (isset($res['image_url']) && !empty($res['image_url'])) {
603
- $meta->setMeta('og_image', trim($res['image_url']));
604
- $meta->updateMeta((int) $_POST['post_ID']);
605
- }
606
- }
607
- if ((int) $value->networkId == 2 && $metaCard == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
608
- $metaCard = true;
609
- $meta = B2S_Meta::getInstance();
610
- $meta->getMeta((int) $_POST['post_ID']);
611
- if (isset($res['image_url']) && !empty($res['image_url'])) {
612
- $meta->setMeta('card_image', trim($res['image_url']));
613
- $meta->updateMeta((int) $_POST['post_ID']);
614
- }
615
- }
616
- //END MetaTags
617
- }
618
- }
619
- }
620
- }
621
- if ($sched_type != 3) {
622
- if (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) {
623
- $dateFormat = ($_POST['b2s-user-lang'] == 'de') ? 'd.m.Y' : 'Y-m-d';
624
- $_POST['b2s_update_publish_date'] = date($dateFormat, strtotime($sched_date));
625
- }
626
- }
627
- add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
628
- }
629
- } else {
630
- add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
631
- }
632
- } else {
633
- if (strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") {
634
- add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
635
- }
636
- }
637
- }
638
- }
639
- }
640
- }
641
- }
642
- }
643
-
644
- public function b2s_add_param_auto_share_meta_box($location) {
645
- remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
646
- if (isset($_POST['b2s_update_publish_date'])) {
647
- return add_query_arg(array('b2s_action' => 1, 'b2s_update_publish_date' => $_POST['b2s_update_publish_date']), $location);
648
- }
649
- return add_query_arg(array('b2s_action' => 1), $location);
650
- }
651
-
652
- public function b2s_add_param_auto_share_error_meta_box($location) {
653
- remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
654
- return add_query_arg(array('b2s_action' => 2), $location);
655
- }
656
-
657
- public function b2s_add_param_auto_share_error_data_meta_box($location) {
658
- remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
659
- return add_query_arg(array('b2s_action' => 3), $location);
660
- }
661
-
662
- public function b2s_save_post_alert_meta_box() {
663
- if (isset($_GET['b2s_action'])) {
664
- $b2sAction = $_GET['b2s_action'];
665
- if ((int) $b2sAction == 1) {
666
- $b2sLink = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=';
667
- if (isset($_GET['b2s_update_publish_date']) && !empty($_GET['b2s_update_publish_date'])) {
668
- $publishDate = htmlspecialchars($_GET['b2s_update_publish_date']);
669
- echo '<div class="updated"><p>' . __('This post will be shared into your social media from', 'blog2social') . ' ' . $publishDate . ' <a target="_blank" href="' . $b2sLink . 'blog2social-sched">' . __('show details', 'blog2social') . '</a></p></div>';
670
- } else {
671
- echo '<div class="updated"><p>' . __('This post will be shared on social media in 2-3 minutes!', 'blog2social') . ' <a target="_blank" href="' . $b2sLink . 'blog2social-publish">' . __('show details', 'blog2social') . '</a></p></div>';
672
- }
673
- }
674
- if ((int) $b2sAction == 2) {
675
- echo '<div class="error"><p>' . __('Please, make sure that your post are publish on this blog on this moment. Then you can auto post your post with Blog2social.', 'blog2social') . '</p></div>';
676
- }
677
- if ((int) $b2sAction == 3) {
678
- echo '<div class="error"><p>' . __('There are no authorizations for your selected profile. Please, authorize with a social network or select a other profile.', 'blog2social') . '</p></div>';
679
- }
680
- }
681
- }
682
-
683
- public function plugin_init_language() {
684
- load_plugin_textdomain('blog2social', false, B2S_PLUGIN_LANGUAGE_PATH);
685
- $this->defineText();
686
- }
687
-
688
- public function override_plugin_action_links($links) {
689
- if (defined("B2S_PLUGIN_USER_VERSION") && B2S_PLUGIN_USER_VERSION == 0) {
690
- $added_link = array('<a target="_blank" style="color: rgba(10, 154, 62, 1); font-weight: bold; font-size: 13px;" href="' . B2S_Tools::getSupportLink('affiliate') . '">' . __('Upgrade to Premium', 'blog2social') . '</a>');
691
- $links = array_merge($added_link, $links);
692
- }
693
-
694
- if (!isset($links['deactivate'])) {
695
- return $links;
696
- }//end if
697
-
698
- if (is_network_admin()) {
699
- return $links;
700
- }//end if
701
-
702
- preg_match_all('/<a[^>]+href="(.+?)"[^>]*>/i', $links['deactivate'], $matches);
703
- if (empty($matches) || !isset($matches[1][0])) {
704
- return $links;
705
- }//end if
706
-
707
- if (isset($matches[1][0])) {
708
- $links['deactivate'] = sprintf(
709
- '<a id="b2s-deactivate" href="%s">%s</a>', $matches[1][0], // @codingStandardsIgnoreLine
710
- esc_html(_x('Deactivate', 'command (plugins)', 'Blog2Social'))
711
- );
712
- }
713
- wp_enqueue_style('B2SPOSTBOXCSS');
714
- wp_enqueue_script('B2SPOSTBOXJS');
715
-
716
- return $links;
717
- }
718
-
719
- public function defineText() {
720
- define('B2S_PLUGIN_PAGE_TITLE', serialize(array('blog2social-notice' => __('Notifications', 'blog2social'), 'blog2social-publish' => __('Shared Posts', 'blog2social'), 'blog2social-approve' => __('Instant Sharing', 'blog2social'), 'blog2social-sched' => __('Scheduled Posts', 'blog2social'), 'blog2social-curation-draft' => __('Content Curation Drafts', 'blog2social'),)));
721
- define('B2S_PLUGIN_NETWORK_TYPE', serialize(array(__('Profile', 'blog2social'), __('Page', 'blog2social'), __('Group', 'blog2social'))));
722
- define('B2S_PLUGIN_NETWORK_KIND', serialize(array(__('Company', 'blog2social'), __('Business', 'blog2social'))));
723
- define('B2S_PLUGIN_NETWORK_ERROR', serialize(array('DEFAULT' => __('Your post could not be posted.', 'blog2social'),
724
- 'TOKEN' => __('Your authorization has expired. Please reconnect your account in the Blog2Social network settings.', 'blog2social'),
725
- 'CONTENT' => __('The network has marked the post as spam or abusive.', 'blog2social'),
726
- 'RIGHT' => __('We don\'t have the permission to publish your post. Please check your authorization.', 'blog2social'),
727
- 'LOGIN' => __('Your authorization is interrupted. Please check your authorization. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
728
- 'LIMIT' => __('Your daily limit has been reached.', 'blog2social'),
729
- 'IMAGE' => __('Your post could not be posted, because your image is not available or the image source does not allow to publish', 'blog2social'),
730
- 'PROTECT' => __('The network has blocked your account. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
731
- 'IMAGE_LIMIT' => __('The number of images is reached. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
732
- 'RATE_LIMIT' => __('Your daily limit for this network has been reached. Please try again later.', 'blog2social'),
733
- 'INVALID_CONTENT' => __('The network can not publish special characters such as Emoji. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
734
- 'EXISTS_CONTENT' => __('Your post is a duplicate.', 'blog2social'),
735
- 'URL_CONTENT' => __('The network requires a public url.', 'blog2social'),
736
- 'BLOGPOST_NOT_PUBLISHED' => __('Your blog post was not available for the network at the time of publication.', 'blog2social'),
737
- 'EXISTS_RELAY' => __('You have already retweeted this post.', 'blog2social'),
738
- 'DEPRECATED_NETWORK_8' => __('This XING API is no longer supported by XING. Please connect your XING accounts with the new XING interface to reschedule your posts. <a target="_blank" href="https://www.blog2social.com/en/faq/index.php?action=artikel&cat=2&id=146">Learn more</a>', 'blog2social'),
739
- 'IMAGE_FOR_CURATION' => __('There was no image in the meta data of the linked post. Posts without images cannot be shared on image networks.', 'blog2social'), // special for content curation V.5.0.0
740
- 'IMAGE_NETWORK' => __('Your post could not be posted, because your image can not be processed by the network.', 'blog2social'),
741
- 'GROUP_CONTENT' => __('Your group can not be found by the network.', 'blog2social'))));
742
- }
743
-
744
- public function getToken() {
745
- global $wpdb;
746
- $sql = $wpdb->prepare("SELECT token FROM `b2s_user` WHERE `blog_user_id` = %d", $this->blogUserData->ID);
747
- $userExist = $wpdb->get_row($sql);
748
- if (empty($userExist) || !isset($userExist->token)) {
749
- if (isset($_GET['page']) && !empty($_GET['page']) && in_array($_GET['page'], unserialize(B2S_PLUGIN_PAGE_SLUG))) {
750
- $postData = array('action' => 'getToken', 'blog_user_id' => $this->blogUserData->ID, 'blog_url' => get_option('home'), 'email' => $this->blogUserData->user_email);
751
- $result = json_decode(B2S_Tools::getToken($postData));
752
- if (isset($result->result) && (int) $result->result == 1 && isset($result->token)) {
753
- $state_url = (isset($result->state_url)) ? (int) $result->state_url : 0;
754
- $sqlInsertToken = $wpdb->prepare("INSERT INTO `b2s_user` (`token`, `blog_user_id`,`register_date`,`state_url`) VALUES (%s,%d,%s,%d);", $result->token, (int) $this->blogUserData->ID, date('Y-m-d H:i:s'), $state_url);
755
- $wpdb->query($sqlInsertToken);
756
- define('B2S_PLUGIN_TOKEN', $result->token);
757
- } else {
758
- define('B2S_PLUGIN_NOTICE', 'CONNECTION');
759
- }
760
- }
761
- } else {
762
- define('B2S_PLUGIN_TOKEN', $userExist->token);
763
- }
764
- }
765
-
766
- public function getUserDetails() {
767
- $tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . B2S_PLUGIN_BLOG_USER_ID);
768
- if ($tokenInfo == false || !isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) || !isset($tokenInfo['B2S_PLUGIN_VERSION']) || $tokenInfo['B2S_PLUGIN_USER_VERSION_NEXT_REQUEST'] < time() || (isset($tokenInfo['B2S_PLUGIN_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_VERSION'] < (int) B2S_PLUGIN_VERSION) || (isset($tokenInfo['B2S_PLUGIN_TRAIL_END']) && strtotime($tokenInfo['B2S_PLUGIN_TRAIL_END']) < strtotime(gmdate('Y-m-d H:i:s')))) {
769
- B2S_Tools::setUserDetails();
770
- $this->checkUpdate();
771
- } else {
772
- define('B2S_PLUGIN_USER_VERSION', $tokenInfo['B2S_PLUGIN_USER_VERSION']);
773
- if (isset($tokenInfo['B2S_PLUGIN_TRAIL_END'])) {
774
- define('B2S_PLUGIN_TRAIL_END', $tokenInfo['B2S_PLUGIN_TRAIL_END']);
775
- }
776
- }
777
- }
778
-
779
- private function checkUpdate() {
780
- $args = array(
781
- 'timeout' => '15',
782
- 'redirection' => '5',
783
- 'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)"
784
- );
785
- $result = wp_remote_retrieve_body(wp_remote_get(B2S_PLUGIN_API_ENDPOINT . 'update.txt', $args));
786
- $currentVersion = explode('#', $result);
787
- if (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) {
788
- define('B2S_PLUGIN_NOTICE', 'UPDATE');
789
- }
790
- }
791
-
792
- public function createMenu() {
793
- $subPages = array();
794
- //pageTitle,menutitle,$capability, $menu_slug, $function, $icon_url, $position
795
- add_menu_page('Blog2Social', 'Blog2Social', 'read', 'blog2social', null, plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE));
796
- //$parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function
797
- $subPages[] = add_submenu_page('blog2social', __('Dashboard', 'blog2social'), __('Dashboard', 'blog2social'), 'read', 'blog2social', array($this, 'b2sstart'));
798
- $subPages[] = add_submenu_page('blog2social', __('Posts & Sharing', 'blog2social'), __('Posts & Sharing', 'blog2social'), 'read', 'blog2social-post', array($this, 'b2sPost'));
799
- $subPages[] = add_submenu_page('blog2social', __('Calendar', 'blog2social'), __('Calendar', 'blog2social'), 'read', 'blog2social-calendar', array($this, 'b2sPostCalendar'));
800
- $subPages[] = add_submenu_page('blog2social', __('Content Curation', 'blog2social'), __('Content Curation', 'blog2social'), 'read', 'blog2social-curation', array($this, 'b2sContentCuration'));
801
- $subPages[] = add_submenu_page('blog2social', __('Networks', 'blog2social'), __('Networks', 'blog2social'), 'read', 'blog2social-network', array($this, 'b2sNetwork'));
802
- $subPages[] = add_submenu_page('blog2social', __('Settings', 'blog2social'), __('Settings', 'blog2social'), 'read', 'blog2social-settings', array($this, 'b2sSettings'));
803
- $subPages[] = add_submenu_page('blog2social', __('PR-Service', 'blog2social'), __('PR-Service', 'blog2social'), 'read', 'prg-post', array($this, 'prgPost'));
804
- $subPages[] = add_submenu_page('blog2social', __('Help & Support', 'blog2social'), __('Help & Support', 'blog2social'), 'read', 'blog2social-support', array($this, 'b2sSupport'));
805
- $subPages[] = add_submenu_page('blog2social', __('Premium', 'blog2social'), '<span class="dashicons dashicons-star-filled"></span> ' . __('PREMIUM', 'blog2social'), 'read', 'blog2social-premium', array($this, 'b2sPremium'));
806
- $subPages[] = add_submenu_page(null, 'B2S Post Sched', 'B2S Post Sched', 'read', 'blog2social-sched', array($this, 'b2sPostSched'));
807
- $subPages[] = add_submenu_page(null, 'B2S Post Approve', 'B2S Post Approve', 'read', 'blog2social-approve', array($this, 'b2sPostApprove'));
808
- $subPages[] = add_submenu_page(null, 'B2S Post Publish', 'B2S Post Publish', 'read', 'blog2social-publish', array($this, 'b2sPostPublish'));
809
- $subPages[] = add_submenu_page(null, 'B2S Post Notice', 'B2S Post Notice', 'read', 'blog2social-notice', array($this, 'b2sPostNotice')); //Error post page since 4.8.0
810
- $subPages[] = add_submenu_page(null, 'B2S Ship', 'B2S Ship', 'read', 'blog2social-ship', array($this, 'b2sShip'));
811
- $subPages[] = add_submenu_page(null, 'B2S Curation Drafts', 'B2S Curation Drafts', 'read', 'blog2social-curation-draft', array($this, 'b2sCurationDraft'));
812
- $subPages[] = add_submenu_page(null, 'PRG Login', 'PRG Login', 'read', 'prg-login', array($this, 'prgLogin'));
813
- $subPages[] = add_submenu_page(null, 'PRG Ship', 'PRG Ship', 'read', 'prg-ship', array($this, 'prgShip'));
814
- foreach ($subPages as $var) {
815
- add_action($var, array($this, 'addAssets'));
816
- }
817
- }
818
-
819
- public function createToolbarMenu() {
820
- if (!current_user_can('edit_posts')) {
821
- return;
822
- }
823
- global $wp_admin_bar;
824
- $seo_url = strtolower(get_admin_url(null, 'admin.php?page='));
825
- $title = '<div id="blog2social-ab-icon" class="ab-item" style="padding-left: 25px; background-repeat: no-repeat; background-size: 16px auto; background-position: left center; background-image: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\');">' . __('Blog2Social', 'blog2social') . '</div>';
826
- $wp_admin_bar->add_node(array(
827
- 'id' => 'blog2social',
828
- 'title' => $title,
829
- 'href' => $seo_url . 'blog2social'
830
- ));
831
-
832
- $wp_admin_bar->add_node(array(
833
- 'id' => 'blog2social-dashboard',
834
- 'title' => __('Dashboard', 'blog2social'),
835
- 'href' => $seo_url . 'blog2social',
836
- 'parent' => 'blog2social'
837
- ));
838
-
839
- $wp_admin_bar->add_node(array(
840
- 'id' => 'blog2social-post',
841
- 'title' => __('Posts & Sharing', 'blog2social'),
842
- 'href' => $seo_url . 'blog2social-post',
843
- 'parent' => 'blog2social'
844
- ));
845
-
846
- $wp_admin_bar->add_node(array(
847
- 'id' => 'blog2social-calendar',
848
- 'title' => __('Calendar', 'blog2social'),
849
- 'href' => $seo_url . 'blog2social-calendar',
850
- 'parent' => 'blog2social'
851
- ));
852
-
853
-
854
- $wp_admin_bar->add_node(array(
855
- 'id' => 'blog2social-curation',
856
- 'title' => __('Content Curation', 'blog2social'),
857
- 'href' => $seo_url . 'blog2social-curation',
858
- 'parent' => 'blog2social'
859
- ));
860
-
861
- $wp_admin_bar->add_node(array(
862
- 'id' => 'blog2social-network',
863
- 'title' => __('Networks', 'blog2social'),
864
- 'href' => $seo_url . 'blog2social-network',
865
- 'parent' => 'blog2social'
866
- ));
867
- $wp_admin_bar->add_node(array(
868
- 'id' => 'blog2social-settings',
869
- 'title' => __('Settings', 'blog2social'),
870
- 'href' => $seo_url . 'blog2social-settings',
871
- 'parent' => 'blog2social'
872
- ));
873
- $wp_admin_bar->add_node(array(
874
- 'id' => 'blog2social-prg-post',
875
- 'title' => __('PR-Service', 'blog2social'),
876
- 'href' => $seo_url . 'prg-post',
877
- 'parent' => 'blog2social'
878
- ));
879
-
880
- $wp_admin_bar->add_node(array(
881
- 'id' => 'blog2social-support',
882
- 'title' => __('Help & Support', 'blog2social'),
883
- 'href' => $seo_url . 'blog2social-support',
884
- 'parent' => 'blog2social'
885
- ));
886
- $wp_admin_bar->add_node(array(
887
- 'id' => 'blog2social-premium',
888
- 'title' => '<span class="ab-icon dashicons dashicons-star-filled"></span> ' . __('PREMIUM', 'blog2social'),
889
- 'href' => $seo_url . 'blog2social-premium',
890
- 'parent' => 'blog2social'
891
- ));
892
- }
893
-
894
- //PageFunktion
895
- public function b2sstart() {
896
-
897
- if (B2S_Tools::showNotice() == false) {
898
- wp_enqueue_style('B2SFULLCALLENDARCSS');
899
- wp_enqueue_style('B2SCALENDARCSS');
900
- wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
901
- wp_enqueue_script('B2SFULLCALENDARJS');
902
- wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
903
- wp_enqueue_script('B2SLIB');
904
-
905
- wp_enqueue_script('B2SMOMENT');
906
- wp_enqueue_script('B2SCHARTJS');
907
- wp_enqueue_style('B2SSTARTCSS');
908
- wp_enqueue_script('B2SSTARTJS');
909
- wp_enqueue_style('B2SPOSTCSS');
910
- wp_enqueue_script('B2SPOSTJS');
911
- wp_enqueue_style('B2SAIRDATEPICKERCSS');
912
- wp_enqueue_script('B2SAIRDATEPICKERJS');
913
- wp_enqueue_script('B2SAIRDATEPICKERDEJS');
914
- wp_enqueue_script('B2SAIRDATEPICKERENJS');
915
- require_once( B2S_PLUGIN_DIR . 'views/b2s/dashboard.php');
916
- } else {
917
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
918
- }
919
- }
920
-
921
- //PageFunktion
922
- public function b2sPost() {
923
- if (B2S_Tools::showNotice() == false) {
924
- wp_enqueue_style('B2SPOSTCSS');
925
- wp_enqueue_script('B2SPOSTJS');
926
- require_once( B2S_PLUGIN_DIR . 'views/b2s/post.php');
927
- } else {
928
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
929
- }
930
- }
931
-
932
- //Page Curation
933
- public function b2sContentCuration() {
934
- if (B2S_Tools::showNotice() == false) {
935
- wp_enqueue_style('B2SCURATIONCSS');
936
- wp_enqueue_script('B2SCURATIONJS');
937
- wp_enqueue_style('B2SAIRDATEPICKERCSS');
938
- wp_enqueue_script('B2SAIRDATEPICKERJS');
939
- wp_enqueue_script('B2SAIRDATEPICKERDEJS');
940
- wp_enqueue_script('B2SAIRDATEPICKERENJS');
941
- require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.php');
942
- } else {
943
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
944
- }
945
- }
946
-
947
- //PageFunktion
948
- public function b2sNetwork() {
949
- if (B2S_Tools::showNotice() == false) {
950
- wp_enqueue_style('B2SNETWORKCSS');
951
- wp_enqueue_script('B2SNETWORKJS');
952
- wp_enqueue_style('B2STIMEPICKERCSS');
953
- wp_enqueue_script('B2STIMEPICKERJS');
954
- require_once( B2S_PLUGIN_DIR . 'views/b2s/network.php');
955
- } else {
956
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
957
- }
958
- }
959
-
960
- //PageFunktion
961
- public function b2sSettings() {
962
- if (B2S_Tools::showNotice() == false) {
963
- wp_enqueue_style('B2SSETTINGSCSS');
964
- wp_enqueue_script('B2SSETTINGSJS');
965
- wp_enqueue_style('B2STIMEPICKERCSS');
966
- wp_enqueue_script('B2STIMEPICKERJS');
967
- wp_enqueue_style('B2SBTNTOOGLECSS');
968
- wp_enqueue_script('B2SBTNTOOGLEJS');
969
- wp_enqueue_style('B2SCHOSENCSS');
970
- wp_enqueue_script('B2SCHOSENJS');
971
-
972
- if (current_user_can('upload_files')) {
973
- //Capability by Super Admin ,Administrator ,Editor ,Author
974
- wp_enqueue_media();
975
- }
976
- require_once( B2S_PLUGIN_DIR . 'views/b2s/settings.php');
977
- } else {
978
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
979
- }
980
- }
981
-
982
- //PageFunktion
983
- public function b2sShip() {
984
- if (B2S_Tools::showNotice() == false) {
985
-
986
- wp_enqueue_style('B2SFULLCALLENDARCSS');
987
- wp_enqueue_style('B2SCALENDARCSS');
988
- wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
989
- wp_enqueue_script('B2SFULLCALENDARJS');
990
- wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
991
- wp_enqueue_script('B2SLIB');
992
- wp_enqueue_style('B2SSHIPCSS');
993
- wp_enqueue_style('B2SDATEPICKERCSS');
994
- wp_enqueue_style('B2STIMEPICKERCSS');
995
- wp_enqueue_style('B2SWYSIWYGCSS');
996
- wp_enqueue_script('B2SWYSIWYGJS');
997
- if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
998
- wp_enqueue_script('B2SWYSIWYGLANGDEJS');
999
- } else {
1000
- wp_enqueue_script('B2SWYSIWYGLANGENJS');
1001
- }
1002
- wp_enqueue_script('B2SDATEPICKERJS');
1003
- wp_enqueue_script('B2SDATEPICKERDEJS');
1004
- wp_enqueue_script('B2SDATEPICKERENJS');
1005
- wp_enqueue_script('B2STIMEPICKERJS');
1006
- wp_enqueue_script('B2SSHIPJS');
1007
- if (current_user_can('upload_files')) {
1008
- //Capability by Super Admin ,Administrator ,Editor ,Author
1009
- wp_enqueue_media();
1010
- }
1011
- require_once( B2S_PLUGIN_DIR . 'views/b2s/ship.php');
1012
- } else {
1013
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1014
- }
1015
- }
1016
-
1017
- //PageFunktion
1018
- public function b2sCurationDraft() {
1019
- if (B2S_Tools::showNotice() == false) {
1020
- wp_enqueue_style('B2SCURATIONDRAFTCSS');
1021
- wp_enqueue_script('B2SCURATIONDRAFTJS');
1022
- require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.draft.php');
1023
- } else {
1024
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1025
- }
1026
- }
1027
-
1028
- //PageFunktion
1029
- public function prgLogin() {
1030
- if (B2S_Tools::showNotice() == false) {
1031
- $prgInfo = get_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
1032
- if ($prgInfo != false && isset($prgInfo['B2S_PRG_ID']) && (int) $prgInfo['B2S_PRG_ID'] > 0 && isset($prgInfo['B2S_PRG_TOKEN']) && !empty($prgInfo['B2S_PRG_TOKEN'])) {
1033
- $postId = (int) $_GET['postId'];
1034
- echo'<script> window.location="' . admin_url('/admin.php?page=prg-ship&postId=' . $postId, 'http') . '"; </script> ';
1035
- //wp_redirect(admin_url('/admin.php?page=prg-ship&postId=' . $postId, 'http'), 301);
1036
- wp_die();
1037
- } else {
1038
- wp_enqueue_style('PRGLOGINCSS');
1039
- wp_enqueue_script('PRGLOGINJS');
1040
- require_once( B2S_PLUGIN_DIR . 'views/prg/login.php');
1041
- }
1042
- } else {
1043
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1044
- }
1045
- }
1046
-
1047
- //PageFunktion
1048
- public function prgShip() {
1049
- if (B2S_Tools::showNotice() == false) {
1050
- wp_enqueue_style('PRGSHIPCSS');
1051
- wp_enqueue_script('PRGSHIPJS');
1052
- wp_enqueue_script('PRGGENERALJS');
1053
- require_once( B2S_PLUGIN_DIR . 'views/prg/ship.php');
1054
- } else {
1055
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1056
- }
1057
- }
1058
-
1059
- //PageFunktion
1060
- public function b2sPostSched() {
1061
- if (B2S_Tools::showNotice() == false) {
1062
- wp_enqueue_script('B2SLIB');
1063
- wp_enqueue_style('B2SPOSTSCHEDCSS');
1064
- wp_enqueue_style('B2SDATEPICKERCSS');
1065
- wp_enqueue_style('B2STIMEPICKERCSS');
1066
- wp_enqueue_script('B2SDATEPICKERJS');
1067
- wp_enqueue_script('B2SDATEPICKERDEJS');
1068
- wp_enqueue_script('B2SDATEPICKERENJS');
1069
- wp_enqueue_script('B2STIMEPICKERJS');
1070
- wp_enqueue_script('B2SPOSTJS');
1071
- wp_enqueue_style('B2SWYSIWYGCSS');
1072
- wp_enqueue_script('B2SWYSIWYGJS');
1073
- wp_enqueue_script('B2SSHIPJS');
1074
- if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
1075
- wp_enqueue_script('B2SWYSIWYGLANGDEJS');
1076
- } else {
1077
- wp_enqueue_script('B2SWYSIWYGLANGENJS');
1078
- }
1079
- if (current_user_can('upload_files')) {
1080
- //Capability by Super Admin ,Administrator ,Editor ,Author
1081
- wp_enqueue_media();
1082
- }
1083
- require_once( B2S_PLUGIN_DIR . 'views/b2s/post.sched.php');
1084
- } else {
1085
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1086
- }
1087
- }
1088
-
1089
- //PageFunktion
1090
- public function b2sPostApprove() {
1091
- if (B2S_Tools::showNotice() == false) {
1092
- wp_enqueue_style('B2SPOSTAPPROVECSS');
1093
- wp_enqueue_script('B2SPOSTJS');
1094
- require_once( B2S_PLUGIN_DIR . 'views/b2s/post.approve.php');
1095
- } else {
1096
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1097
- }
1098
- }
1099
-
1100
- //PageFunktion
1101
- public function b2sPostCalendar() {
1102
- if (B2S_Tools::showNotice() == false) {
1103
- wp_enqueue_script('B2SLIB');
1104
- wp_enqueue_style('B2SFULLCALLENDARCSS');
1105
- wp_enqueue_style('B2SCALENDARCSS');
1106
- wp_enqueue_style('B2SDATEPICKERCSS');
1107
- wp_enqueue_style('B2STIMEPICKERCSS');
1108
- wp_enqueue_script('B2SDATEPICKERJS');
1109
- wp_enqueue_script('B2SDATEPICKERDEJS');
1110
- wp_enqueue_script('B2SDATEPICKERENJS');
1111
- wp_enqueue_script('B2STIMEPICKERJS');
1112
- wp_enqueue_script('B2SCALENDARJS');
1113
- wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
1114
- wp_enqueue_script('B2SFULLCALENDARJS');
1115
- wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
1116
- wp_enqueue_style('B2SWYSIWYGCSS');
1117
- wp_enqueue_script('B2SWYSIWYGJS');
1118
- wp_enqueue_script('B2SSHIPJS');
1119
- if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
1120
- wp_enqueue_script('B2SWYSIWYGLANGDEJS');
1121
- } else {
1122
- wp_enqueue_script('B2SWYSIWYGLANGENJS');
1123
- }
1124
-
1125
- if (current_user_can('upload_files')) {
1126
- //Capability by Super Admin ,Administrator ,Editor ,Author
1127
- wp_enqueue_media();
1128
- }
1129
- require_once( B2S_PLUGIN_DIR . 'views/b2s/post.calendar.php');
1130
- } else {
1131
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1132
- }
1133
- }
1134
-
1135
- //PageFunktion
1136
- public function b2sSupport() {
1137
- wp_enqueue_style('B2SSUPPORT');
1138
- wp_enqueue_script('B2SSUPPORTJS');
1139
- require_once( B2S_PLUGIN_DIR . 'views/b2s/support.php');
1140
- }
1141
-
1142
- //PageFunktion
1143
- public function b2sPremium() {
1144
- wp_enqueue_style('B2SPREMIUM');
1145
- wp_enqueue_style('B2SCHOSENCSS');
1146
- wp_enqueue_script('B2SCHOSENJS');
1147
- wp_enqueue_script('B2SPREMIUMJS');
1148
- require_once( B2S_PLUGIN_DIR . 'views/b2s/premium.php');
1149
- }
1150
-
1151
- //PageFunktion
1152
- public function b2sPostPublish() {
1153
- if (B2S_Tools::showNotice() == false) {
1154
- wp_enqueue_style('B2SPOSTPUBLISHCSS');
1155
- wp_enqueue_script('B2SPOSTJS');
1156
- wp_enqueue_script('PRGGENERALJS');
1157
- require_once( B2S_PLUGIN_DIR . 'views/b2s/post.publish.php');
1158
- } else {
1159
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1160
- }
1161
- }
1162
-
1163
- //PageFunktion
1164
- public function b2sPostNotice() {
1165
- if (B2S_Tools::showNotice() == false) {
1166
- wp_enqueue_style('B2SPOSTNOTICECSS');
1167
- wp_enqueue_script('B2SPOSTJS');
1168
- wp_enqueue_script('PRGGENERALJS');
1169
- require_once( B2S_PLUGIN_DIR . 'views/b2s/post.notice.php');
1170
- } else {
1171
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1172
- }
1173
- }
1174
-
1175
- //PageFunktion
1176
- public function prgPost() {
1177
- if (B2S_Tools::showNotice() == false) {
1178
- wp_enqueue_style('PRGPOSTCSS');
1179
- wp_enqueue_script('PRGPOSTJS');
1180
- wp_enqueue_script('PRGGENERALJS');
1181
- require_once( B2S_PLUGIN_DIR . 'views/prg/post.php');
1182
- } else {
1183
- require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1184
- }
1185
- }
1186
-
1187
- public function addBootAssets($hook) {
1188
- wp_enqueue_script('B2SVALIDATEJS');
1189
- if ($hook == 'edit.php') {
1190
- wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
1191
- }
1192
-
1193
- if ($hook == 'plugins.php') {
1194
- wp_enqueue_script('B2SPLUGINDEACTIVATEJS');
1195
- wp_enqueue_style('B2SPLUGINDEACTIVATECSS');
1196
- }
1197
- }
1198
-
1199
- public function addAssets() {
1200
- wp_enqueue_style('B2SBOOTCSS');
1201
- wp_enqueue_script('B2SBOOTJS');
1202
- wp_enqueue_script('B2SGENERALJS');
1203
- }
1204
-
1205
- public function registerAssets() {
1206
- wp_register_style('B2SBOOTCSS', plugins_url('assets/css/general.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1207
- wp_register_style('B2SSTARTCSS', plugins_url('assets/css/b2s/start.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1208
- wp_register_style('B2SPOSTCSS', plugins_url('assets/css/b2s/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1209
- wp_register_style('B2SSHIPCSS', plugins_url('assets/css/b2s/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1210
- wp_register_style('B2SCURATIONCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1211
-
1212
- wp_register_style('B2SPOSTSCHEDCSS', plugins_url('assets/css/b2s/post.sched.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1213
- wp_register_style('B2SPOSTAPPROVECSS', plugins_url('assets/css/b2s/post.approve.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1214
- wp_register_style('B2SPOSTPUBLISHCSS', plugins_url('assets/css/b2s/post.publish.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1215
- wp_register_style('B2SPOSTNOTICECSS', plugins_url('assets/css/b2s/post.notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1216
- wp_register_style('B2SNETWORKCSS', plugins_url('assets/css/b2s/network.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1217
- wp_register_style('B2SSUPPORT', plugins_url('assets/css/b2s/support.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1218
- wp_register_style('B2SPREMIUM', plugins_url('assets/css/b2s/premium.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1219
- wp_register_style('B2SSETTINGSCSS', plugins_url('assets/css/b2s/settings.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1220
- wp_register_style('PRGSHIPCSS', plugins_url('assets/css/prg/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1221
- wp_register_style('PRGLOGINCSS', plugins_url('assets/css/prg/login.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1222
- wp_register_style('B2SDATEPICKERCSS', plugins_url('assets/lib/datepicker/css/bootstrap-datepicker3.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1223
- wp_register_style('B2SAIRDATEPICKERCSS', plugins_url('assets/lib/air-datepicker/css/datepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1224
- wp_register_style('B2STIMEPICKERCSS', plugins_url('assets/lib/timepicker/timepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1225
- wp_register_style('PRGPOSTCSS', plugins_url('assets/css/prg/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1226
- wp_register_style('B2SWYSIWYGCSS', plugins_url('assets/lib/wysiwyg/square.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1227
- wp_register_style('B2SPOSTBOXCSS', plugins_url('assets/css/b2s/wp/post-box.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1228
- wp_register_style('B2SNOTICECSS', plugins_url('assets/css/notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1229
- wp_register_style('B2SFULLCALLENDARCSS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1230
- wp_register_style('B2SCALENDARCSS', plugins_url('assets/css/b2s/calendar.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1231
- wp_register_style('B2SBTNTOOGLECSS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1232
- wp_register_style('B2SCHOSENCSS', plugins_url('assets/lib/chosen/chosen.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1233
- wp_register_style('B2SPLUGINDEACTIVATECSS', plugins_url('assets/css/b2s/wp/plugin-deactivate.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1234
- wp_register_style('B2SCURATIONDRAFTCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1235
-
1236
- wp_register_script('B2SNETWORKJS', plugins_url('assets/js/b2s/network.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1237
- wp_register_script('B2SSETTINGSJS', plugins_url('assets/js/b2s/settings.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1238
- wp_register_script('B2SSTARTJS', plugins_url('assets/js/b2s/start.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1239
- wp_register_script('B2SPOSTJS', plugins_url('assets/js/b2s/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1240
- wp_register_script('B2SSHIPJS', plugins_url('assets/js/b2s/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1241
- wp_register_script('B2SCURATIONJS', plugins_url('assets/js/b2s/curation.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1242
- wp_register_script('PRGSHIPJS', plugins_url('assets/js/prg/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1243
- wp_register_script('PRGLOGINJS', plugins_url('assets/js/prg/login.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1244
- wp_register_script('B2SBOOTJS', plugins_url('assets/js/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1245
- wp_register_script('B2SVALIDATEJS', plugins_url('assets/js/validate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1246
-
1247
- wp_register_script('B2SSUPPORTJS', plugins_url('assets/js/b2s/support.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1248
- wp_register_script('B2SGENERALJS', plugins_url('assets/js/b2s/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1249
- wp_register_script('B2SDATEPICKERJS', plugins_url('assets/lib/datepicker/js/bootstrap-datepicker.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1250
- wp_register_script('B2SDATEPICKERDEJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.de_DE.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1251
- wp_register_script('B2SDATEPICKERENJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.en_US.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1252
- wp_register_script('B2SAIRDATEPICKERJS', plugins_url('assets/lib/air-datepicker/js/datepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1253
- wp_register_script('B2SAIRDATEPICKERDEJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1254
- wp_register_script('B2SAIRDATEPICKERENJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1255
- wp_register_script('B2SCHARTJS', plugins_url('assets/lib/chartjs/Chart.bundle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1256
- wp_register_script('B2SMOMENT', plugins_url('assets/lib/moment/moment-with-locales.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1257
- wp_register_script('B2STIMEPICKERJS', plugins_url('assets/lib/timepicker/timepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1258
- wp_register_script('B2SNOTICEJS', plugins_url('assets/js/notice.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1259
- wp_register_script('PRGPOSTJS', plugins_url('assets/js/prg/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1260
- wp_register_script('PRGGENERALJS', plugins_url('assets/js/prg/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1261
- wp_register_script('B2SWYSIWYGJS', plugins_url('assets/lib/wysiwyg/jquery.sceditor.xhtml.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1262
- wp_register_script('B2SWYSIWYGLANGDEJS', plugins_url('assets/lib/wysiwyg/languages/de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1263
- wp_register_script('B2SWYSIWYGLANGENJS', plugins_url('assets/lib/wysiwyg/languages/en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1264
- wp_register_script('B2SPOSTBOXJS', plugins_url('assets/js/b2s/wp/post-box.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1265
- wp_register_script('B2SPOSTSCHEDHEARTBEATJS', plugins_url('assets/js/b2s/wp/post-sched-heartbeat.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1266
- wp_register_script('B2SCALENDARJS', plugins_url('assets/js/b2s/calendar.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1267
- wp_register_script('B2SFULLCALENDARMOMENTJS', plugins_url('assets/lib/fullcalendar/lib/moment.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1268
- wp_register_script('B2SFULLCALENDARJS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1269
- wp_register_script('B2SFULLCALENDARLOCALEJS', plugins_url('assets/lib/fullcalendar/locale-all.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1270
- wp_register_script('B2SBTNTOOGLEJS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1271
- wp_register_script('B2SCHOSENJS', plugins_url('assets/lib/chosen/chosen.jquery.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1272
- wp_register_script('B2SLIB', plugins_url('assets/js/b2s/lib.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1273
- wp_register_script('B2SPLUGINDEACTIVATEJS', plugins_url('assets/js/b2s/wp/plugin-deactivate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1274
- wp_register_script('B2SCURATIONDRAFTJS', plugins_url('assets/js/b2s/curation.draft.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1275
- wp_register_script('B2SPREMIUMJS', plugins_url('assets/js/b2s/premium.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1276
- }
1277
-
1278
- public function activatePlugin() {
1279
- require_once (B2S_PLUGIN_DIR . 'includes/System.php');
1280
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1281
- $b2sSystem = new B2S_System();
1282
- $b2sCheckBefore = $b2sSystem->check('before');
1283
- if (is_array($b2sCheckBefore)) {
1284
- $b2sSystem->deactivatePlugin();
1285
- wp_die($b2sSystem->getErrorMessage($b2sCheckBefore) . ' ' . __('or', 'blog2social') . ' <a href="' . admin_url("/plugins.php", "http") . '/">' . __('back to install plugins', 'blog2social') . '</a>');
1286
- }
1287
-
1288
- global $wpdb;
1289
- //Start Old Plugin
1290
- $sqlDeleteFirst = 'DROP TABLE IF EXISTS `prg_connect_sent`';
1291
- $wpdb->query($sqlDeleteFirst);
1292
- $sqlDeleteSecond = 'DROP TABLE IF EXISTS `prg_connect_config`';
1293
- $wpdb->query($sqlDeleteSecond);
1294
- //END Old Plugin
1295
- $sqlCreateUser = "CREATE TABLE IF NOT EXISTS `b2s_user` (
1296
- `id` int(11) NOT NULL AUTO_INCREMENT,
1297
- `token` varchar(255) NOT NULL,
1298
- `blog_user_id` int(11) NOT NULL,
1299
- `feature` TINYINT(2) NOT NULL,
1300
- `state_url` TINYINT(2) NOT NULL,
1301
- `register_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1302
- PRIMARY KEY (`id`), INDEX `blog_user_id` (`blog_user_id`), INDEX `token` (`token`), INDEX `feature` (`feature`)
1303
- ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;";
1304
- $wpdb->query($sqlCreateUser);
1305
-
1306
- $b2sUserCols = $wpdb->get_results('SHOW COLUMNS FROM b2s_user');
1307
- if (is_array($b2sUserCols) && isset($b2sUserCols[0])) {
1308
- $b2sUserColsData = array();
1309
- foreach ($b2sUserCols as $key => $value) {
1310
- if (isset($value->Field) && !empty($value->Field)) {
1311
- $b2sUserColsData[] = $value->Field;
1312
- }
1313
- }
1314
- if (!in_array("register_date", $b2sUserColsData)) {
1315
- $wpdb->query("ALTER TABLE b2s_user ADD register_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
1316
- }
1317
- if (!in_array("state_url", $b2sUserColsData)) {
1318
- $wpdb->query("ALTER TABLE b2s_user ADD state_url TINYINT(2) NOT NULL DEFAULT '1'");
1319
- }
1320
- }
1321
-
1322
- //Notice Rating - stop rating remember again
1323
- //$wpdb->query('UPDATE `b2s_user` SET `feature` = 0');
1324
-
1325
- $keys = $wpdb->get_results('SHOW INDEX FROM `b2s_user`');
1326
- $allowIndexUser = array('PRIMARY', 'blog_user_id', 'token', 'feature');
1327
- foreach ($keys as $k => $value) {
1328
- if (!in_array($value->Key_name, $allowIndexUser)) {
1329
- $wpdb->query('ALTER TABLE `b2s_user` DROP INDEX ' . $value->Key_name);
1330
- }
1331
- }
1332
-
1333
- $sqlCreateUserPosts = "CREATE TABLE IF NOT EXISTS `b2s_posts` (
1334
- `id` int(11) NOT NULL AUTO_INCREMENT,
1335
- `post_id` int(11) NOT NULL,
1336
- `blog_user_id` int(11) NOT NULL,
1337
- `last_edit_blog_user_id` int(11) NOT NULL,
1338
- `user_timezone` TINYINT NOT NULL DEFAULT '0',
1339
- `sched_details_id` INT NOT NULL,
1340
- `sched_type` TINYINT NOT NULL DEFAULT '0',
1341
- `sched_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1342
- `sched_date_utc` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1343
- `publish_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1344
- `publish_link` varchar(255) NOT NULL,
1345
- `publish_error_code` varchar(100) NOT NULL,
1346
- `network_details_id` int(11) NOT NULL,
1347
- `post_for_relay` TINYINT NOT NULL DEFAULT '0',
1348
- `post_for_approve` TINYINT NOT NULL DEFAULT '0',
1349
- `relay_primary_post_id` int(11) NOT NULL DEFAULT '0',
1350
- `relay_delay_min` int(11) NOT NULL DEFAULT '0',
1351
- `hook_action` TINYINT NOT NULL DEFAULT '0',
1352
- `hide` TINYINT NOT NULL DEFAULT '0',
1353
- `v2_id` int(11) NOT NULL DEFAULT '0',
1354
- PRIMARY KEY (`id`), INDEX `post_id` (`post_id`), INDEX `blog_user_id` (`blog_user_id`) , INDEX `sched_details_id` (`sched_details_id`),
1355
- INDEX `sched_date` (`sched_date`), INDEX `sched_date_utc` (`sched_date_utc`), INDEX `publish_date` (`publish_date`) , INDEX `relay_primary_post_id` (`relay_primary_post_id`) ,
1356
- INDEX `hook_action` (`hook_action`), INDEX `hide` (`hide`)
1357
- ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
1358
- $wpdb->query($sqlCreateUserPosts);
1359
-
1360
- //since V4.8.0
1361
- $b2sPostsCols = $wpdb->get_results('SHOW COLUMNS FROM b2s_posts');
1362
- if (is_array($b2sPostsCols) && isset($b2sPostsCols[0])) {
1363
- $b2sPostsColsData = array();
1364
- foreach ($b2sPostsCols as $key => $value) {
1365
- if (isset($value->Field) && !empty($value->Field)) {
1366
- $b2sPostsColsData[] = $value->Field;
1367
- }
1368
- }
1369
- if (!in_array("last_edit_blog_user_id", $b2sPostsColsData)) {
1370
- $wpdb->query("ALTER TABLE b2s_posts ADD last_edit_blog_user_id INT NOT NULL DEFAULT '0'");
1371
- }
1372
- if (!in_array("post_for_relay", $b2sPostsColsData)) {
1373
- $wpdb->query("ALTER TABLE b2s_posts ADD post_for_relay TINYINT NOT NULL DEFAULT '0'");
1374
- }
1375
- if (!in_array("post_for_approve", $b2sPostsColsData)) {
1376
- $wpdb->query("ALTER TABLE b2s_posts ADD post_for_approve TINYINT NOT NULL DEFAULT '0'");
1377
- }
1378
- if (!in_array("relay_primary_post_id", $b2sPostsColsData)) {
1379
- $wpdb->query("ALTER TABLE b2s_posts ADD relay_primary_post_id int(11) NOT NULL DEFAULT '0'");
1380
- $wpdb->query('ALTER TABLE `b2s_posts` ADD INDEX(`relay_primary_post_id`)');
1381
- }
1382
- if (!in_array("relay_delay_min", $b2sPostsColsData)) {
1383
- $wpdb->query("ALTER TABLE b2s_posts ADD relay_delay_min int(11) NOT NULL DEFAULT '0'");
1384
- }
1385
- }
1386
-
1387
- $keys = $wpdb->get_results('SHOW INDEX FROM `b2s_posts`');
1388
- $allowIndexPosts = array('PRIMARY', 'post_id', 'blog_user_id', 'sched_details_id', 'sched_date', 'sched_date_utc', 'publish_date', 'relay_primary_post_id', 'hook_action', 'hide');
1389
- foreach ($keys as $k => $value) {
1390
- if (!in_array($value->Key_name, $allowIndexPosts)) {
1391
- $wpdb->query('ALTER TABLE `b2s_posts` DROP INDEX ' . $value->Key_name);
1392
- }
1393
- }
1394
-
1395
- //Change Collation >=V4.0 Emoji
1396
- $existsTable = $wpdb->get_results('SHOW TABLES LIKE "b2s_posts_sched_details"');
1397
- if (is_array($existsTable) && !empty($existsTable)) {
1398
- $wpdb->query('ALTER TABLE `b2s_posts_sched_details` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
1399
- $wpdb->query('ALTER TABLE `b2s_posts_sched_details` CHANGE sched_data sched_data TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
1400
- $wpdb->query('REPAIR TABLE `b2s_posts_sched_details`');
1401
- $wpdb->query('OPTIMIZE TABLE `b2s_posts_sched_details`');
1402
- } else {
1403
- $sqlCreateUserSchedDetails = "CREATE TABLE IF NOT EXISTS `b2s_posts_sched_details` (
1404
- `id` int(11) NOT NULL AUTO_INCREMENT,
1405
- `sched_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
1406
- `image_url` varchar(255) NOT NULL,
1407
- PRIMARY KEY (`id`)
1408
- ) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1 ;";
1409
- $wpdb->query($sqlCreateUserSchedDetails);
1410
- }
1411
-
1412
- $sqlCreateUserNetworkDetails = "CREATE TABLE IF NOT EXISTS `b2s_posts_network_details` (
1413
- `id` int(11) NOT NULL AUTO_INCREMENT,
1414
- `network_id` TINYINT NOT NULL,
1415
- `network_type` TINYINT NOT NULL,
1416
- `network_auth_id` int(11) NOT NULL,
1417
- `network_display_name` varchar(100) NOT NULL,
1418
- PRIMARY KEY (`id`)
1419
- ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
1420
- $wpdb->query($sqlCreateUserNetworkDetails);
1421
-
1422
- $sqlCreateUserContact = "CREATE TABLE IF NOT EXISTS `b2s_user_contact`(
1423
- `id` int(5) NOT NULL AUTO_INCREMENT ,
1424
- `blog_user_id` int(11) NOT NULL ,
1425
- `name_mandant` varchar(100) NOT NULL ,
1426
- `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1427
- `name_presse` varchar(100) NOT NULL ,
1428
- `anrede_presse` enum('0','1','2') NOT NULL DEFAULT '0' COMMENT '0=Frau,1=Herr 2=keine Angabe',
1429
- `vorname_presse` varchar(50) NOT NULL ,
1430
- `nachname_presse` varchar(50) NOT NULL ,
1431
- `strasse_presse` varchar(100) NOT NULL ,
1432
- `nummer_presse` varchar(5) NOT NULL DEFAULT '',
1433
- `plz_presse` varchar(10) NOT NULL ,
1434
- `ort_presse` varchar(75) NOT NULL ,
1435
- `land_presse` varchar(3) NOT NULL DEFAULT 'DE',
1436
- `email_presse` varchar(75) NOT NULL ,
1437
- `telefon_presse` varchar(30) NOT NULL ,
1438
- `fax_presse` varchar(30) NOT NULL ,
1439
- `url_presse` varchar(150) NOT NULL ,
1440
- PRIMARY KEY (`id`) ,
1441
- KEY `blog_user_id`(`blog_user_id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1";
1442
- $wpdb->query($sqlCreateUserContact);
1443
-
1444
-
1445
- $sqlCreateNetworkSettings = 'CREATE TABLE IF NOT EXISTS `b2s_user_network_settings` (
1446
- `id` int(11) NOT NULL AUTO_INCREMENT,
1447
- `blog_user_id` int(11) NOT NULL,
1448
- `mandant_id` int(11) NOT NULL,
1449
- `network_auth_id` int(11) NOT NULL,
1450
- PRIMARY KEY (`id`),
1451
- INDEX `blog_user_id` (`blog_user_id`), INDEX `mandant_id` (`mandant_id`)
1452
- ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;';
1453
- $wpdb->query($sqlCreateNetworkSettings);
1454
-
1455
-
1456
- /*
1457
- * SET SAFETY AUTO-INCREMENT
1458
- */
1459
-
1460
- $wpdb->query("ALTER TABLE `b2s_posts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1461
- $wpdb->query("ALTER TABLE `b2s_posts_sched_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1462
- $wpdb->query("ALTER TABLE `b2s_posts_network_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1463
- $wpdb->query("ALTER TABLE `b2s_user` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1464
- $wpdb->query("ALTER TABLE `b2s_user_contact` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1465
- $wpdb->query("ALTER TABLE `b2s_user_network_settings` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1466
-
1467
- $b2sCheckAfter = $b2sSystem->check('after');
1468
- if (is_array($b2sCheckAfter)) {
1469
- $b2sSystem->deactivatePlugin();
1470
- wp_die($b2sSystem->getErrorMessage($b2sCheckAfter) . ' ' . __('or', 'blog2social') . ' <a href="' . admin_url("/plugins.php", "http") . '/">' . __('back to install plugins', 'blog2social') . '</a>');
1471
- }
1472
-
1473
- //Activate Social Meta Tags
1474
- $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
1475
- if ($options->_getOption('og_active') === false || $options->_getOption('card_active') === false) {
1476
- $options->_setOption('og_active', 1);
1477
- $options->_setOption('card_active', 1);
1478
- }
1479
- }
1480
-
1481
- public function deactivatePlugin() {
1482
- $optionDeleteSchedPosts = get_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
1483
- if ($optionDeleteSchedPosts !== false && (int) $optionDeleteSchedPosts == 1) {
1484
- global $wpdb;
1485
- $sqlPosts = "SELECT a.token FROM `b2s_user` a INNER JOIN b2s_posts ON a.`blog_user_id` = b2s_posts.`blog_user_id` where b2s_posts.`hide` = 0 AND b2s_posts.`sched_type` != 3 AND b2s_posts.`publish_date`= '0000-00-00 00:00:00' GROUP by a.blog_user_id";
1486
- $results = $wpdb->get_results($sqlPosts, ARRAY_A);
1487
- if (is_array($results) && !empty($results)) {
1488
- $tempData = array('action' => 'deleteBlogSchedPost', 'host' => get_site_url(), 'data' => serialize($results));
1489
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
1490
- if (isset($result->result) && $result->result == true) {
1491
- $data = array('hide' => '1', 'hook_action' => '0');
1492
- $where = array('publish_date' => '0000-00-00 00:00:00', 'hide' => '0');
1493
- $wpdb->update('b2s_posts', $data, $where, array('%d', '%d'), array('%d', '%d'));
1494
- delete_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
1495
- }
1496
- }
1497
- }
1498
- }
1499
-
1500
- public function releaseLocks() {
1501
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1502
- $options = new B2S_Options(get_current_user_id());
1503
- $lock = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
1504
-
1505
- if ($lock) {
1506
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $lock);
1507
- $options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", false);
1508
- }
1509
- }
1510
-
1511
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class B2S_Loader {
4
+
5
+ public $blogUserData;
6
+ public $lastVersion;
7
+
8
+ public function __construct() {
9
+
10
+ }
11
+
12
+ public function load() {
13
+ if (!is_admin()) {
14
+ $this->call_public_hooks();
15
+ }
16
+ $this->call_global_hooks();
17
+ if (is_admin()) {
18
+ $this->call_admin_hooks();
19
+ }
20
+ }
21
+
22
+ public function call_global_hooks() {
23
+
24
+ $this->b2s_register_custom_post_type();
25
+
26
+ require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
27
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
28
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
29
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/Heartbeat.php');
30
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Post.php');
31
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Get.php');
32
+ require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
33
+ require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
34
+
35
+ define('B2S_PLUGIN_POSTPERPAGE', '15');
36
+ define('B2S_PLUGIN_VERSION_TYPE', serialize(array(0 => 'Free', 1 => 'Smart', 2 => 'Pro', 3 => 'Business', 4 => 'Premium')));
37
+ define('B2S_PLUGIN_NETWORK', serialize(array(1 => 'Facebook', 2 => 'Twitter', 3 => 'Linkedin', 4 => 'Tumblr', 5 => 'Storify', 6 => 'Pinterest', 7 => 'Flickr', 8 => 'Xing', 9 => 'Diigo', 10 => 'Google+', 11 => 'Medium', 12 => 'Instagram', 13 => 'Delicious', 14 => 'Torial', 15 => 'Reddit', 16 => 'Bloglovin', 17 => 'VKontakte', 18 => 'Google My Business', 19 => 'Xing', 20 => 'Pinterest')));
38
+ define('B2S_PLUGIN_SCHED_DEFAULT_TIMES', serialize(array(1 => array(18, 22), 2 => array(8, 10), 3 => array(8, 10), 4 => array(16, 22), 5 => array(), 6 => array(19, 22), 7 => array(7, 9), 8 => array(7, 10), 9 => array(16, 19), 10 => array(7, 10), 11 => array(16, 19), 12 => array(19, 22), 13 => array(11, 13), 14 => array(18, 22), 15 => array(8, 11), 16 => array(16, 19), 17 => array(19, 23), 18 => array(17, 18), 19 => array(7, 10))));
39
+ define('B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO', serialize(array(1 => array(0 => array(13, 16), 1 => array(18, 22)), 2 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 3 => array(0 => array(8, 10), 1 => array(16, 18)), 4 => array(), 5 => array(), 6 => array(0 => array(12, 14), 1 => array(19, 22)), 7 => array(0 => array(7, 9), 1 => array(17, 19)), 8 => array(0 => array(7, 10), 1 => array(17, 18)), 9 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 10 => array(0 => array(7, 10), 1 => array(14, 15)), 11 => array(), 12 => array(0 => array(12, 14), 1 => array(19, 22)), 13 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 14 => array(), 15 => array(0 => array(8, 11)), 16 => array(0 => array(16, 19)), 17 => array(0 => array(19, 23)), 18 => array(0 => array(17, 18)), 19 => array(0 => array(7, 10), 1 => array(17, 18)), 20 => array(0 => array(12, 14), 1 => array(19, 22)))));
40
+ define('B2S_PLUGIN_NETWORK_ALLOW_PROFILE', serialize(array(1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
41
+ define('B2S_PLUGIN_NETWORK_ALLOW_PAGE', serialize(array(1, 3, 10, 17, 19)));
42
+ define('B2S_PLUGIN_NETWORK_ALLOW_GROUP', serialize(array(1, 10, 11, 17, 19)));
43
+ define('B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT', serialize(array(19 => array(2 => 3)))); //2=group
44
+ define('B2S_PLUGIN_NETWORK_ALLOW_MODIFY_BOARD_AND_GROUP', serialize(array(6 => array('TYPE' => array(0), 'TITLE' => __('Modify pin board', 'blog2social')), 8 => array('TYPE' => array(2), 'TITLE' => __('Edit group settings', 'blog2social')), 15 => array('TYPE' => array(0), 'TITLE' => __('Modify subreddit', 'blog2social')), 19 => array('TYPE' => array(2), 'TITLE' => __('Modify forum', 'blog2social')), 20 => array('TYPE' => array(0), 'TITLE' => __('Modify pin board', 'blog2social')))));
45
+ define('B2S_PLUGIN_AUTO_POST_LIMIT', serialize(array(0 => 0, 1 => 25, 2 => 50, 3 => 100, 4 => 100)));
46
+ define('B2S_PLUGIN_NETWORK_OAUTH', serialize(array(1, 2, 3, 4, 7, 8, 11, 15, 17, 18, 20)));
47
+ define('B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT', serialize(array(
48
+ 1 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 500), 'content' => '{CONTENT}', 'format' => 0),
49
+ 1 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => '{CONTENT}', 'format' => 0),
50
+ 2 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => '{CONTENT}', 'format' => 0)
51
+ ),
52
+ 2 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 255, 'range_max' => 256, 'excerpt_range_min' => 255, 'excerpt_range_max' => 256, 'limit' => 280), 'content' => '{CONTENT}', 'format' => 1)),
53
+ 3 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 1300), 'content' => '{CONTENT}', 'format' => 0),
54
+ 1 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 400, 'excerpt_range_min' => 239, 'excerpt_range_max' => 400, 'limit' => 1300), 'content' => '{CONTENT}', 'format' => 0),
55
+ ),
56
+ 12 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 240, 'range_max' => 400, 'excerpt_range_min' => 240, 'excerpt_range_max' => 400, 'limit' => 2000), 'content' => '{CONTENT}', 'format' => 1)),
57
+ 19 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 239, 'range_max' => 320, 'excerpt_range_min' => 239, 'excerpt_range_max' => 320, 'limit' => 420), 'content' => '{CONTENT}', 'format' => 0))
58
+ )));
59
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_WORDPRESSVERSION', '4.4.2');
60
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPVERSION', '5.5.3');
61
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_MYSQLVERSION', '5.5.3');
62
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_DATABASERIGHTS', true);
63
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_HEARTBEAT', true);
64
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPCURL', true);
65
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPDOM', true);
66
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_HOTLINKPROTECTION', true);
67
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_PLUGINWARNING_WORDS', serialize(array('hotlink', 'firewall', 'security', 'heartbeat')));
68
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_WPJSON', true);
69
+ define('B2S_PLUGIN_SYSTEMREQUIREMENT_OPENSSL', true);
70
+ define('B2S_PLUGIN_PAGE_SLUG', serialize(array('blog2social', 'blog2social-post', 'blog2social-calendar', 'blog2social-curation', 'blog2social-network', 'blog2social-settings', 'prg-post', 'blog2social-support', 'blog2social-premium', 'blog2social-sched', 'blog2social-approve', 'blog2social-publish', 'blog2social-notice', 'blog2social-ship', 'blog2social-curation-draft', 'blog2social-draft-post', 'prg-login', 'prg-ship')));
71
+
72
+ add_filter('heartbeat_received', array(B2S_Heartbeat::getInstance(), 'init'), 10, 2);
73
+ add_action('wp_logout', array($this, 'releaseLocks'));
74
+ add_action('transition_post_status', array($this, 'b2s_auto_post_import'), 9999, 3); //for Auto-Posting imported + manuell
75
+ add_action('rest_api_init', array($this, 'b2s_rest_api_init'));
76
+ }
77
+
78
+ public function call_admin_hooks() {
79
+
80
+ require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
81
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/PostBox.php');
82
+ require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
83
+ require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Post.php');
84
+ require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Get.php');
85
+ require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Post.php');
86
+ require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Get.php');
87
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
88
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
89
+ require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
90
+ require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
91
+
92
+ define('B2S_PLUGIN_BLOG_USER_ID', get_current_user_id());
93
+ define('B2S_PLUGIN_ADMIN', current_user_can('edit_others_posts'));
94
+
95
+ $this->blogUserData = get_userdata(B2S_PLUGIN_BLOG_USER_ID);
96
+
97
+ //deactivated since 4.2.0
98
+ //add_action('plugins_loaded', array($this, 'update_db_check'));
99
+
100
+ $this->update_db_check();
101
+
102
+ add_action('admin_init', array($this, 'registerAssets'));
103
+ add_action('admin_enqueue_scripts', array($this, 'addBootAssets'));
104
+ add_action('admin_menu', array($this, 'createMenu'));
105
+ add_action('admin_bar_menu', array($this, 'createToolbarMenu'), 94);
106
+ add_action('admin_notices', array('B2S_Notice', 'getProVersionNotice'));
107
+ add_action('admin_notices', array($this, 'b2s_save_post_alert_meta_box'));
108
+ add_action('add_meta_boxes', array($this, 'b2s_load_post_box'));
109
+ add_action('save_post', array($this, 'b2s_save_post_box'), 1, 3);
110
+ add_action('trash_post', array($this, 'b2s_delete_sched_post'), 10);
111
+
112
+ add_action('admin_footer', array($this, 'plugin_deactivate_add_modal'));
113
+ add_filter('plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'override_plugin_action_links'));
114
+
115
+ Ajax_Get::getInstance();
116
+ Ajax_Post::getInstance();
117
+
118
+ if ((int) B2S_PLUGIN_BLOG_USER_ID > 0) {
119
+ $this->getToken();
120
+ $this->getUserDetails();
121
+ }
122
+ $this->plugin_init_language();
123
+ }
124
+
125
+ public function call_public_hooks() {
126
+ add_filter('wp_footer', array($this, 'b2s_get_full_content'), 99); //for shortcodes
127
+ add_action('wp_head', array($this, 'b2s_build_frontend_meta'), 1); // for MetaTags
128
+ }
129
+
130
+ public function b2s_build_frontend_meta() {
131
+ require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
132
+ B2S_Meta::getInstance()->_run();
133
+ }
134
+
135
+ public function b2s_rest_api_init() {
136
+ register_rest_route('blog2social/v1/post', '/authorize', array(
137
+ 'methods' => WP_REST_Server::CREATABLE,
138
+ 'callback' => array($this, 'b2s_rest_api_post_authorize')
139
+ ));
140
+ }
141
+
142
+ public function b2s_rest_api_post_authorize($post = array()) {
143
+ $contentType = 'application/json';
144
+ if (isset($post['token']) && !empty($post['token']) && isset($post['user']) && !empty($post['user']) && isset($post['network_id']) && (int) $post['network_id'] > 0) {
145
+ $privateKey = B2S_PLUGIN_DIR . '/includes/B2S/Api/Network/private_key.pem';
146
+ if (function_exists('openssl_public_decrypt') && file_exists($privateKey)) {
147
+ if ((int) $post['network_id'] == 6) {
148
+ try {
149
+ require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
150
+ $user = '';
151
+ $pass = '';
152
+ $getPrivateKey = file_get_contents($privateKey);
153
+ openssl_private_decrypt(base64_decode(trim($post['user']['pass'])), $pass, $getPrivateKey);
154
+ openssl_private_decrypt(base64_decode(trim($post['user']['name'])), $user, $getPrivateKey);
155
+ $pt = new B2S_Api_Network_Pinterest();
156
+ $result = $pt->authorize($user, $pass);
157
+ $status = isset($result['cookie_data']) && !empty($result['cookie_data']) ? 200 : 400;
158
+ $response = array('code' => $status, 'result' => array_merge($result, array('token' => $post['token'], 'network_id' => (int) $post['network_id'])));
159
+ return new WP_REST_Response($response, $status, array('Content-Type: ' . $contentType));
160
+ } catch (Exception $ex) {
161
+ $response = array('code' => 500, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 8, 'error_data' => serialize($ex->getMessage())));
162
+ return new WP_REST_Response($response, 500, array('Content-Type: ' . $contentType));
163
+ }
164
+ }
165
+ $response = array('code' => 409, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'network_not_exists'));
166
+ return new WP_REST_Response($response, 409, array('Content-Type: ' . $contentType));
167
+ }
168
+ $response = array('code' => 501, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'openssl_not_exists'));
169
+ return new WP_REST_Response($response, 501, array('Content-Type: ' . $contentType));
170
+ }
171
+ $response = array('code' => 502, 'result' => array('error' => 1, 'error_pos' => 10, 'error_data' => 'bad_request'));
172
+ return new WP_REST_Response($response, 502, array('Content-Type: ' . $contentType));
173
+ }
174
+
175
+ private function b2s_register_custom_post_type() {
176
+ if (post_type_exists("b2s_ex_post")) {
177
+ return;
178
+ }
179
+ register_post_type('b2s_ex_post', array('public' => false, 'label' => 'Related Posts for Blog2Social'));
180
+ }
181
+
182
+ public function plugin_deactivate_add_modal() {
183
+ include_once(B2S_PLUGIN_DIR . '/views/b2s/partials/plugin-deactivate-modal.php');
184
+ }
185
+
186
+ public function b2s_auto_post_import($new_status, $old_status, $post) {
187
+
188
+ //is first publish
189
+ if ($old_status != 'publish' && $old_status != 'trash' && $new_status == 'publish' && isset($post->post_author) && (int) $post->post_author > 0) {
190
+ if (wp_is_post_revision($post->ID)) {
191
+ return;
192
+ }
193
+ //is lock if manuell Auto-Posting in form
194
+ $isLock = get_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
195
+ if ($isLock === false) {
196
+ $options = new B2S_Options((int) $post->post_author);
197
+ $autoPostData = $options->_getOption('auto_post_import');
198
+ if ($autoPostData !== false && is_array($autoPostData)) {
199
+ if (isset($autoPostData['active']) && (int) $autoPostData['active'] == 1) {
200
+
201
+ //Premium
202
+ $tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . (int) $post->post_author);
203
+ if ($tokenInfo !== false && isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'] >= 1) {
204
+ $filter = true;
205
+ if (isset($autoPostData['post_filter']) && (int) $autoPostData['post_filter'] == 1) {
206
+ if (isset($autoPostData['post_type']) && is_array($autoPostData['post_type']) && !empty($autoPostData['post_type'])) {
207
+ if (isset($autoPostData['post_type_state']) && (int) $autoPostData['post_type_state'] == 0) { //include
208
+ if (!in_array($post->post_type, $autoPostData['post_type'])) {
209
+ $filter = false;
210
+ }
211
+ } else { //exclude
212
+ if (in_array($post->post_type, $autoPostData['post_type'])) {
213
+ $filter = false;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ if ($filter && isset($autoPostData['network_auth_id']) && !empty($autoPostData['network_auth_id']) && is_array($autoPostData['network_auth_id'])) {
219
+ //LIMIT
220
+ $limit = false;
221
+ $ship = false;
222
+ $optionUserTimeZone = $options->_getOption('user_time_zone');
223
+ $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
224
+ $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
225
+ $current_utc_datetime = gmdate('Y-m-d H:i:s');
226
+ $current_user_date = date('Y-m-d', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
227
+
228
+ $autoPostCon = $options->_getOption('auto_post_import_condition');
229
+ $conData = array();
230
+ if ($autoPostCon !== false && is_array($autoPostCon) && isset($autoPostCon['count']) && isset($autoPostCon['last_call_date'])) {
231
+ $con = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
232
+ $userVersion = (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'];
233
+ $limitCount = (isset($con[$userVersion]) && !empty($con[$userVersion])) ? $con[$userVersion] : $con[1]; //25 default
234
+ if (($autoPostCon['count'] < $limitCount) || ($current_user_date != $autoPostCon['last_call_date'])) {
235
+ $limit = true;
236
+ $count = ($current_user_date != $autoPostCon['last_call_date']) ? 1 : $autoPostCon['count'] + 1;
237
+ $conData = array('count' => $count, 'last_call_date' => $current_user_date);
238
+ }
239
+ } else {
240
+ $limit = true;
241
+ $conData = array('count' => 1, 'last_call_date' => $current_user_date);
242
+ }
243
+ if (!empty($conData)) {
244
+ $options->_setOption('auto_post_import_condition', $conData);
245
+ }
246
+
247
+ if ($limit) {
248
+ global $wpdb;
249
+ $optionPostFormat = $options->_getOption('post_template');
250
+ $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $post->ID));
251
+ //WooCommerce keyword support
252
+ if ($post->post_type == 'product' && taxonomy_exists('product_tag')) {
253
+ $keywords = wp_get_post_terms((int) $post->ID, 'product_tag');
254
+ } else {
255
+ $keywords = wp_get_post_tags((int) $post->ID);
256
+ }
257
+ $url = get_permalink($post->ID);
258
+ $title = isset($post->post_title) ? B2S_Util::getTitleByLanguage(strip_tags($post->post_title)) : '';
259
+ $content = (isset($post->post_content) && !empty($post->post_content)) ? trim($post->post_content) : '';
260
+ $excerpt = (isset($post->post_excerpt) && !empty($post->post_excerpt)) ? trim($post->post_excerpt) : '';
261
+ $delay = (isset($autoPostData['ship_state']) && (int) $autoPostData['ship_state'] = 0) ? 0 : (isset($autoPostData['ship_delay_time']) ? (int) $autoPostData['ship_delay_time'] : 0);
262
+ $current_user_datetime = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
263
+
264
+ //ShareNow
265
+ $sched_type = 3;
266
+ $time = ($delay == 0) ? "-30 seconds" : "+" . $delay . " minutes";
267
+ $sched_date = date('Y-m-d H:i:s', strtotime($time, strtotime($current_user_datetime)));
268
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime($time, strtotime($current_user_datetime)));
269
+
270
+ $optionNoCache = $options->_getOption('link_no_cache');
271
+ $optionUserHashTag = $options->_getOption('user_allow_hashtag');
272
+ $allowHashTag = ($optionUserHashTag === false || $optionUserHashTag == 1) ? true : false;
273
+
274
+ $defaultPostData = array('default_titel' => $title,
275
+ 'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
276
+ 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
277
+ 'no_cache' => (($optionNoCache === false || $optionNoCache == 0) ? 0 : 1), //default inactive , 1=active 0=not
278
+ 'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $userTimeZoneOffset);
279
+
280
+ $defaultBlogPostData = array('post_id' => (int) $post->ID, 'blog_user_id' => (int) $post->post_author, 'user_timezone' => $userTimeZoneOffset, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
281
+
282
+ $autoShare = new B2S_AutoPost((int) $post->ID, $defaultBlogPostData, $current_user_date, false, $title, $content, $excerpt, $url, $image_url, $keywords, trim(strtolower(substr(B2S_LANGUAGE, 0, 2))), $optionPostFormat, $allowHashTag);
283
+
284
+ //TOS Twitter 032018 - none multiple Accounts - User select once
285
+ $networkTos = true;
286
+
287
+ foreach ($autoPostData['network_auth_id'] as $k => $value) {
288
+ $networkDetails = $wpdb->get_results($wpdb->prepare("SELECT postNetworkDetails.network_id, postNetworkDetails.network_type, postNetworkDetails.network_display_name FROM b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $value));
289
+ if (is_array($networkDetails) && isset($networkDetails[0]->network_id) && isset($networkDetails[0]->network_type) && isset($networkDetails[0]->network_display_name)) {
290
+
291
+ //TOS Twitter 032018 - none multiple Accounts - User select once
292
+ if ((int) $networkDetails[0]->network_id != 2 || ( (int) $networkDetails[0]->network_id == 2 && $networkTos)) {
293
+ //at first: set one profile
294
+ if ((int) $networkDetails[0]->network_id == 2) {
295
+ $networkTos = false;
296
+ }
297
+ $res = $autoShare->prepareShareData($value, $networkDetails[0]->network_id, $networkDetails[0]->network_type);
298
+ if ($res !== false && is_array($res)) {
299
+ $ship = true;
300
+ $res = array_merge($res, $defaultPostData);
301
+ $autoShare->saveShareData($res, $networkDetails[0]->network_id, $networkDetails[0]->network_type, $value, 0, strip_tags($networkDetails[0]->network_display_name));
302
+ }
303
+ }
304
+ }
305
+ }
306
+ if ($ship) {
307
+ B2S_Heartbeat::getInstance()->postToServer();
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ } else {
315
+ //Unlock Auto-Post-Import
316
+ delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
317
+ }
318
+ }
319
+ }
320
+
321
+ public function update_db_check() {
322
+ $this->lastVersion = get_option('b2s_plugin_version');
323
+ if ($this->lastVersion == false || (int) $this->lastVersion < B2S_PLUGIN_VERSION) {
324
+ $this->activatePlugin();
325
+ update_option('b2s_plugin_version', B2S_PLUGIN_VERSION, false);
326
+ }
327
+ }
328
+
329
+ public function b2s_delete_sched_post($post_id) {
330
+ wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
331
+ if ((int) $post_id > 0) {
332
+ global $wpdb;
333
+ //Heartbeat => b2s_delete_sched_post
334
+ $sql = "SELECT id, post_for_approve FROM b2s_posts WHERE post_id = %d AND hook_action <= %d AND hide = %d AND sched_date_utc != %s AND publish_date = %s";
335
+ $deleteData = $wpdb->get_results($wpdb->prepare($sql, $post_id, 2, 0, "0000-00-00 00:00:00", "0000-00-00 00:00:00"), ARRAY_A);
336
+ if (is_array($deleteData) && !empty($deleteData) && isset($deleteData[0])) {
337
+ foreach ($deleteData as $k => $value) {
338
+ if ((int) $value['id'] > 0) {
339
+ if ((int) $value['post_for_approve'] == 1) {
340
+ $data = array('hook_action' => '0', 'hide' => 1);
341
+ } else {
342
+ $data = array('hook_action' => '3', 'hide' => 1);
343
+ }
344
+ $where = array('id' => (int) $value['id']);
345
+ $wpdb->update('b2s_posts', $data, $where, array('%d'), array('%d'));
346
+ }
347
+ }
348
+ }
349
+ }
350
+ }
351
+
352
+ public function b2s_get_full_content() {
353
+ if (isset($_GET['b2s_get_full_content'])) {
354
+ $b2sPostContent = do_shortcode(get_the_content());
355
+ $b2sPostId = get_the_ID();
356
+ update_option('B2S_PLUGIN_POST_CONTENT_' . $b2sPostId, $b2sPostContent, false);
357
+ }
358
+ }
359
+
360
+ public function b2s_load_post_box() {
361
+ if (defined("B2S_PLUGIN_TOKEN")) {
362
+ $post_types = get_post_types(array('public' => true));
363
+ if (is_array($post_types) && !empty($post_types)) {
364
+ foreach ($post_types as $post_type) {
365
+ add_meta_box('b2s-post-meta-box-auto', '<span style="padding: 10px 0 10px 25px; background: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\') no-repeat left center;"></span>' . __('Auto-Post on Social Media', 'blog2social'), array($this, 'b2s_view_post_box'), $post_type, 'side', 'high');
366
+ add_meta_box('b2s-post-box-calendar-header', '<span style="padding: 10px 0 10px 25px; background: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\') no-repeat left center;"></span>' . __('Social Media Content Calendar', 'blog2social'), array($this, 'b2s_view_post_box_calendar'), $post_type, 'normal', 'high');
367
+ }
368
+ }
369
+ }
370
+ }
371
+
372
+ public function b2s_view_post_box() {
373
+ wp_enqueue_style('B2SAIRDATEPICKERCSS');
374
+ wp_enqueue_style('B2SPOSTBOXCSS');
375
+ wp_enqueue_script('B2SAIRDATEPICKERJS');
376
+ wp_enqueue_script('B2SAIRDATEPICKERDEJS');
377
+ wp_enqueue_script('B2SAIRDATEPICKERENJS');
378
+ wp_enqueue_script('B2SPOSTBOXJS');
379
+
380
+ wp_nonce_field("b2s-meta-box-nonce-post-area", "b2s-meta-box-nonce");
381
+ $postId = (isset($_GET['post']) && (int) $_GET['post'] > 0) ? (int) $_GET['post'] : 0;
382
+ $postType = (isset($_GET['post_type']) && !empty($_GET['post_type'])) ? $_GET['post_type'] : get_post_type($postId);
383
+ $postStatus = ($postId != 0) ? get_post_status($postId) : '';
384
+ $postBox = new B2S_PostBox();
385
+ echo $postBox->getPostBox($postId, $postType, $postStatus);
386
+ }
387
+
388
+ public function b2s_view_post_box_calendar() {
389
+ wp_enqueue_style('B2SFULLCALLENDARCSS');
390
+ wp_enqueue_style('B2SCALENDARCSS');
391
+ wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
392
+ wp_enqueue_script('B2SFULLCALENDARJS');
393
+ wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
394
+ wp_enqueue_script('B2SLIB');
395
+ echo '<div class="b2s-post-box-calendar-content"></div>';
396
+ }
397
+
398
+ public function b2s_save_post_box() {
399
+
400
+ if (!isset($_POST['wphb-clear-cache'])) { // WP-Hummingbird BTN clear cache - protection
401
+ if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
402
+ if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
403
+ //Gutenberg WP V5.0 - B2S V5.1.0 optimization
404
+ if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
405
+ $content = get_post((int) $_POST['post_ID']);
406
+ if (!isset($_POST['post_title'])) {
407
+ $_POST['post_title'] = $content->post_title;
408
+ }
409
+ if (!isset($_POST['content'])) {
410
+ $_POST['content'] = $content->post_content;
411
+ }
412
+ }
413
+
414
+ $b2sPostLang = (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) ? $_POST['b2s-user-lang'] : 'en';
415
+ //OgMeta
416
+ if (isset($_POST['isOgMetaChecked']) && (int) $_POST['isOgMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
417
+ $meta = B2S_Meta::getInstance();
418
+ $meta->getMeta(((int) $_POST['post_ID']));
419
+ $title = B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang));
420
+ if (has_excerpt((int) $_POST['post_ID'])) {
421
+ $desc = strip_tags(get_the_excerpt());
422
+ } else {
423
+ $desc = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($_POST['content'])), 0, 160));
424
+ }
425
+ $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
426
+ $meta->setMeta('og_title', $title);
427
+ $meta->setMeta('og_desc', $desc);
428
+ $meta->setMeta('og_image', (($image_url !== false) ? trim(urldecode($image_url)) : ''));
429
+ $meta->updateMeta((int) $_POST['post_ID']);
430
+ }
431
+
432
+ //CardMeta
433
+ if (isset($_POST['isCardMetaChecked']) && (int) $_POST['isCardMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
434
+ $meta = B2S_Meta::getInstance();
435
+ $meta->getMeta(((int) $_POST['post_ID']));
436
+ $title = B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang));
437
+ if (has_excerpt((int) $_POST['post_ID'])) {
438
+ $desc = strip_tags(get_the_excerpt());
439
+ } else {
440
+ $desc = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($_POST['content'])), 0, 160));
441
+ }
442
+ $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
443
+ $meta->setMeta('card_title', $title);
444
+ $meta->setMeta('card_desc', $desc);
445
+ $meta->setMeta('card_image', (($image_url !== false) ? trim(urldecode($image_url)) : ''));
446
+ $meta->updateMeta((int) $_POST['post_ID']);
447
+ }
448
+
449
+ 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'])) {
450
+ if (strtolower($_POST['b2s-post-meta-box-time-dropdown']) == 'publish') {
451
+ if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
452
+ $profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
453
+ if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
454
+ $networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
455
+ if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
456
+ $user_timezone = isset($_POST['b2s-user-timezone']) ? $_POST['b2s-user-timezone'] : 0;
457
+ $current_utc_date = gmdate('Y-m-d H:i:s');
458
+ $current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
459
+
460
+ //WP User Sched Post + B2S Share NOW FRIST SAVE
461
+ $post_date = '';
462
+ if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
463
+ $post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
464
+ }
465
+
466
+ //WP User Sched Post + B2S Share NOW SECOND SAVE
467
+ if (empty($post_date) && strtolower($_POST['post_status']) == "future") {
468
+ if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
469
+ $wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
470
+ } else {
471
+ //V5.0.0 Gutenberg Editor
472
+ $wp_user_sched_post_date = get_the_date('Y-m-d H:i:s', $_POST['post_ID']);
473
+ }
474
+ $post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
475
+ }
476
+
477
+ //ShareNow
478
+ $sched_type = 3;
479
+ $sched_date = $current_user_date;
480
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime("-30 seconds", strtotime($current_utc_date)));
481
+ $myTimeSettings = false;
482
+
483
+ //allow for User Post Date (Schedule)
484
+ if (!empty($post_date) && $current_user_date <= $post_date) {
485
+ $sched_type = 2;
486
+
487
+ if (date('i', strtotime($post_date)) <= 30) {
488
+ $sched_date = date('Y-m-d H:30:00', strtotime($post_date));
489
+ } else {
490
+ $sched_date = date('Y-m-d H:00:00', strtotime('+1 hours', strtotime($post_date)));
491
+ }
492
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
493
+ }
494
+
495
+ //Schedule post once
496
+ if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 1) {
497
+ $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'));
498
+ //Check User Schedule Date in past!
499
+ if ($user_sched_date >= $sched_date) {
500
+ $sched_type = 2;
501
+ $sched_date = $user_sched_date;
502
+ $sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
503
+ }
504
+ } else if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 2) {
505
+ //allow for my Time Settings
506
+ if (isset($_POST['b2s-post-meta-box-best-time-settings'])) {
507
+ $sched_type = 2;
508
+ $myTimeSettings = unserialize(stripslashes($_POST['b2s-post-meta-box-best-time-settings']));
509
+ if ($myTimeSettings !== false && is_array($myTimeSettings) && isset($myTimeSettings['times']) && isset($myTimeSettings['type'])) {
510
+ $myTimeSettings = $myTimeSettings;
511
+ }
512
+ }
513
+ }
514
+
515
+ delete_option('B2S_PLUGIN_POST_CONTENT_' . (int) $_POST['post_ID']);
516
+ $image_url = wp_get_attachment_url(get_post_thumbnail_id((int) $_POST['post_ID']));
517
+ //WooCommerce keyword support
518
+ if (get_post_type((int) $_POST['post_ID']) == 'product' && taxonomy_exists('product_tag')) {
519
+ $keywords = get_the_terms((int) $_POST['post_ID'], 'product_tag');
520
+ } else {
521
+ $keywords = get_the_tags((int) $_POST['post_ID']);
522
+ }
523
+ $url = get_permalink($_POST['post_ID']);
524
+ $title = isset($_POST['post_title']) ? B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang)) : '';
525
+ $content = (isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : '';
526
+ $excerpt = (isset($_POST['excerpt']) && !empty($_POST['excerpt'])) ? trim($_POST['excerpt']) : get_the_excerpt((int) $_POST['post_ID']);
527
+
528
+ $options = new B2S_Options((int) $_POST['user_ID']);
529
+ $optionPostFormat = $options->_getOption('post_template');
530
+ $optionNoCache = $options->_getOption('link_no_cache');
531
+ $optionUserHashTag = $options->_getOption('user_allow_hashtag');
532
+ $allowHashTag = ($optionUserHashTag === false || $optionUserHashTag == 1) ? true : false;
533
+
534
+ $defaultPostData = array('default_titel' => $title,
535
+ 'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
536
+ 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
537
+ 'no_cache' => (($optionNoCache === false || $optionNoCache == 0) ? 0 : 1), //default inactive , 1=active 0=not
538
+ 'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $user_timezone); // 'publish_date' => $sched_date, OLD FOR Share Now?
539
+
540
+ $defaultBlogPostData = array('post_id' => (int) $_POST['post_ID'], 'blog_user_id' => (int) $_POST['user_ID'], 'user_timezone' => $user_timezone, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
541
+
542
+ $autoShare = new B2S_AutoPost((int) $_POST['post_ID'], $defaultBlogPostData, $current_user_date, $myTimeSettings, $title, $content, $excerpt, $url, $image_url, $keywords, $b2sPostLang, $optionPostFormat, $allowHashTag);
543
+ define('B2S_SAVE_META_BOX_AUTO_SHARE', $_POST['post_ID']);
544
+ if (isset($_POST['b2s-user-last-selected-profile-id']) && (int) $_POST['b2s-user-last-selected-profile-id'] != (int) $_POST['b2s-post-meta-box-profil-dropdown'] && (int) $_POST['b2s-post-meta-box-profil-dropdown'] != 0) {
545
+ update_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . $_POST['user_ID'], (int) $_POST['b2s-post-meta-box-profil-dropdown'], false);
546
+ }
547
+
548
+ $metaOg = false;
549
+ $metaCard = false;
550
+ $tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
551
+
552
+
553
+ //>V5.6.0 Scheduling lookup existing posts - delete entries (hook_action) - merge with current networkData & insert
554
+ if ($sched_type == 2) {
555
+ global $wpdb;
556
+ $getSchedData = $wpdb->prepare("SELECT b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM b2s_posts b LEFT JOIN b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 2, "0000-00-00 00:00:00", 0);
557
+ $schedDataResult = $wpdb->get_results($getSchedData);
558
+ $delete_scheds = array();
559
+ foreach ($schedDataResult as $k => $value) {
560
+ $isNew = true;
561
+ foreach ($networkData as $j => $currvalue) {
562
+ if ($value->networkAuthId == $currvalue->networkAuthId) {
563
+ $isNew = false;
564
+ }
565
+ }
566
+ if ($isNew) {
567
+ array_push($networkData, $value);
568
+ }
569
+ array_push($delete_scheds, $value->b2sPostId);
570
+ }
571
+ if (!empty($delete_scheds)) {
572
+ require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
573
+ B2S_Post_Tools::deleteUserSchedPost($delete_scheds);
574
+ }
575
+ }
576
+
577
+
578
+ //TOS Twitter 032018 - none multiple Accounts - User select once
579
+ $selectedTwitterProfile = (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && !empty($_POST['b2s-post-meta-box-profil-dropdown-twitter'])) ? (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] : '';
580
+ foreach ($networkData as $k => $value) {
581
+ if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
582
+ //TOS Twitter 032018 - none multiple Accounts - User select once
583
+ if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
584
+
585
+ //TOS Crossposting ignore
586
+ //Filter: TOS Crossposting ignore
587
+ if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
588
+ continue;
589
+ }
590
+
591
+ $res = $autoShare->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType);
592
+ if ($res !== false && is_array($res)) {
593
+ $res = array_merge($res, $defaultPostData);
594
+ $shareApprove = (isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0;
595
+ $autoShare->saveShareData($res, $value->networkId, $value->networkType, $value->networkAuthId, $shareApprove, strip_tags($value->networkUserName));
596
+
597
+ //Start - Change/Set MetaTags
598
+ //TODO Check Enable Feature
599
+ if ((int) $value->networkId == 1 && $metaOg == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
600
+ $metaOg = true;
601
+ $meta = B2S_Meta::getInstance();
602
+ $meta->getMeta((int) $_POST['post_ID']);
603
+ if (isset($res['image_url']) && !empty($res['image_url'])) {
604
+ $meta->setMeta('og_image', trim($res['image_url']));
605
+ $meta->updateMeta((int) $_POST['post_ID']);
606
+ }
607
+ }
608
+ if ((int) $value->networkId == 2 && $metaCard == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
609
+ $metaCard = true;
610
+ $meta = B2S_Meta::getInstance();
611
+ $meta->getMeta((int) $_POST['post_ID']);
612
+ if (isset($res['image_url']) && !empty($res['image_url'])) {
613
+ $meta->setMeta('card_image', trim($res['image_url']));
614
+ $meta->updateMeta((int) $_POST['post_ID']);
615
+ }
616
+ }
617
+ //END MetaTags
618
+ }
619
+ }
620
+ }
621
+ }
622
+ if ($sched_type != 3) {
623
+ if (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) {
624
+ $dateFormat = ($_POST['b2s-user-lang'] == 'de') ? 'd.m.Y' : 'Y-m-d';
625
+ $_POST['b2s_update_publish_date'] = date($dateFormat, strtotime($sched_date));
626
+ }
627
+ }
628
+ add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
629
+ }
630
+ } else {
631
+ add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
632
+ }
633
+ } else {
634
+ if (strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") {
635
+ add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
636
+ }
637
+ }
638
+ }
639
+ }
640
+ }
641
+ }
642
+ }
643
+ }
644
+
645
+ public function b2s_add_param_auto_share_meta_box($location) {
646
+ remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
647
+ if (isset($_POST['b2s_update_publish_date'])) {
648
+ return add_query_arg(array('b2s_action' => 1, 'b2s_update_publish_date' => $_POST['b2s_update_publish_date']), $location);
649
+ }
650
+ return add_query_arg(array('b2s_action' => 1), $location);
651
+ }
652
+
653
+ public function b2s_add_param_auto_share_error_meta_box($location) {
654
+ remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
655
+ return add_query_arg(array('b2s_action' => 2), $location);
656
+ }
657
+
658
+ public function b2s_add_param_auto_share_error_data_meta_box($location) {
659
+ remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
660
+ return add_query_arg(array('b2s_action' => 3), $location);
661
+ }
662
+
663
+ public function b2s_save_post_alert_meta_box() {
664
+ if (isset($_GET['b2s_action'])) {
665
+ $b2sAction = $_GET['b2s_action'];
666
+ if ((int) $b2sAction == 1) {
667
+ $b2sLink = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=';
668
+ if (isset($_GET['b2s_update_publish_date']) && !empty($_GET['b2s_update_publish_date'])) {
669
+ $publishDate = htmlspecialchars($_GET['b2s_update_publish_date']);
670
+ echo '<div class="updated"><p>' . __('This post will be shared into your social media from', 'blog2social') . ' ' . $publishDate . ' <a target="_blank" href="' . $b2sLink . 'blog2social-sched">' . __('show details', 'blog2social') . '</a></p></div>';
671
+ } else {
672
+ echo '<div class="updated"><p>' . __('This post will be shared on social media in 2-3 minutes!', 'blog2social') . ' <a target="_blank" href="' . $b2sLink . 'blog2social-publish">' . __('show details', 'blog2social') . '</a></p></div>';
673
+ }
674
+ }
675
+ if ((int) $b2sAction == 2) {
676
+ echo '<div class="error"><p>' . __('Please, make sure that your post are publish on this blog on this moment. Then you can auto post your post with Blog2social.', 'blog2social') . '</p></div>';
677
+ }
678
+ if ((int) $b2sAction == 3) {
679
+ echo '<div class="error"><p>' . __('There are no authorizations for your selected profile. Please, authorize with a social network or select a other profile.', 'blog2social') . '</p></div>';
680
+ }
681
+ }
682
+ }
683
+
684
+ public function plugin_init_language() {
685
+ load_plugin_textdomain('blog2social', false, B2S_PLUGIN_LANGUAGE_PATH);
686
+ $this->defineText();
687
+ }
688
+
689
+ public function override_plugin_action_links($links) {
690
+ if (defined("B2S_PLUGIN_USER_VERSION") && B2S_PLUGIN_USER_VERSION == 0) {
691
+ $added_link = array('<a target="_blank" style="color: rgba(10, 154, 62, 1); font-weight: bold; font-size: 13px;" href="' . B2S_Tools::getSupportLink('affiliate') . '">' . __('Upgrade to Premium', 'blog2social') . '</a>');
692
+ $links = array_merge($added_link, $links);
693
+ }
694
+
695
+ if (!isset($links['deactivate'])) {
696
+ return $links;
697
+ }//end if
698
+
699
+ if (is_network_admin()) {
700
+ return $links;
701
+ }//end if
702
+
703
+ preg_match_all('/<a[^>]+href="(.+?)"[^>]*>/i', $links['deactivate'], $matches);
704
+ if (empty($matches) || !isset($matches[1][0])) {
705
+ return $links;
706
+ }//end if
707
+
708
+ if (isset($matches[1][0])) {
709
+ $links['deactivate'] = sprintf(
710
+ '<a id="b2s-deactivate" href="%s">%s</a>', $matches[1][0], // @codingStandardsIgnoreLine
711
+ esc_html(_x('Deactivate', 'command (plugins)', 'Blog2Social'))
712
+ );
713
+ }
714
+ wp_enqueue_style('B2SPOSTBOXCSS');
715
+ wp_enqueue_script('B2SPOSTBOXJS');
716
+
717
+ return $links;
718
+ }
719
+
720
+ public function defineText() {
721
+ define('B2S_PLUGIN_PAGE_TITLE', serialize(array('blog2social-notice' => __('Notifications', 'blog2social'), 'blog2social-publish' => __('Shared Posts', 'blog2social'), 'blog2social-approve' => __('Instant Sharing', 'blog2social'), 'blog2social-draft-post' => __('Drafts', 'blog2social'), 'blog2social-sched' => __('Scheduled Posts', 'blog2social'), 'blog2social-curation-draft' => __('Content Curation Drafts', 'blog2social'),)));
722
+ define('B2S_PLUGIN_NETWORK_TYPE', serialize(array(__('Profile', 'blog2social'), __('Page', 'blog2social'), __('Group', 'blog2social'))));
723
+ define('B2S_PLUGIN_NETWORK_KIND', serialize(array(__('Company', 'blog2social'), __('Business', 'blog2social'))));
724
+ define('B2S_PLUGIN_NETWORK_ERROR', serialize(array('DEFAULT' => __('Your post could not be posted.', 'blog2social'),
725
+ 'TOKEN' => __('Your authorization has expired. Please reconnect your account in the Blog2Social network settings.', 'blog2social'),
726
+ 'CONTENT' => __('The network has marked the post as spam or abusive.', 'blog2social'),
727
+ 'RIGHT' => __('We don\'t have the permission to publish your post. Please check your authorization.', 'blog2social'),
728
+ 'LOGIN' => __('Your authorization is interrupted. Please check your authorization. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
729
+ 'LIMIT' => __('Your daily limit has been reached.', 'blog2social'),
730
+ 'IMAGE' => __('Your post could not be posted, because your image is not available or the image source does not allow to publish', 'blog2social'),
731
+ 'PROTECT' => __('The network has blocked your account. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
732
+ 'IMAGE_LIMIT' => __('The number of images is reached. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
733
+ 'RATE_LIMIT' => __('Your daily limit for this network has been reached. Please try again later.', 'blog2social'),
734
+ 'INVALID_CONTENT' => __('The network can not publish special characters such as Emoji. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html">FAQ</a>.', 'blog2social'),
735
+ 'EXISTS_CONTENT' => __('Your post is a duplicate.', 'blog2social'),
736
+ 'URL_CONTENT' => __('The network requires a public url.', 'blog2social'),
737
+ 'BLOGPOST_NOT_PUBLISHED' => __('Your blog post was not available for the network at the time of publication.', 'blog2social'),
738
+ 'EXISTS_RELAY' => __('You have already retweeted this post.', 'blog2social'),
739
+ 'DEPRECATED_NETWORK_8' => __('This XING API is no longer supported by XING. Please connect your XING accounts with the new XING interface to reschedule your posts. <a target="_blank" href="https://www.blog2social.com/en/faq/index.php?action=artikel&cat=2&id=146">Learn more</a>', 'blog2social'),
740
+ 'IMAGE_FOR_CURATION' => __('There was no image in the meta data of the linked post. Posts without images cannot be shared on image networks.', 'blog2social'), // special for content curation V.5.0.0
741
+ 'IMAGE_NETWORK' => __('Your post could not be posted, because your image can not be processed by the network.', 'blog2social'),
742
+ 'TEXT_NOT_PUBLISHED_12' => __('Instagram published your post without text. Please see <a target="_blank" href="https://www.blog2social.com/en/faq/index.php?action=artikel&cat=9&id=154&artlang=en">FAQ</a>.','blog2social'),
743
+ 'GROUP_CONTENT' => __('Your group can not be found by the network.', 'blog2social'))));
744
+ }
745
+
746
+ public function getToken() {
747
+ global $wpdb;
748
+ $sql = $wpdb->prepare("SELECT token FROM `b2s_user` WHERE `blog_user_id` = %d", $this->blogUserData->ID);
749
+ $userExist = $wpdb->get_row($sql);
750
+ if (empty($userExist) || !isset($userExist->token)) {
751
+ if (isset($_GET['page']) && !empty($_GET['page']) && in_array($_GET['page'], unserialize(B2S_PLUGIN_PAGE_SLUG))) {
752
+ $postData = array('action' => 'getToken', 'blog_user_id' => $this->blogUserData->ID, 'blog_url' => get_option('home'), 'email' => $this->blogUserData->user_email);
753
+ $result = json_decode(B2S_Tools::getToken($postData));
754
+ if (isset($result->result) && (int) $result->result == 1 && isset($result->token)) {
755
+ $state_url = (isset($result->state_url)) ? (int) $result->state_url : 0;
756
+ $sqlInsertToken = $wpdb->prepare("INSERT INTO `b2s_user` (`token`, `blog_user_id`,`register_date`,`state_url`) VALUES (%s,%d,%s,%d);", $result->token, (int) $this->blogUserData->ID, date('Y-m-d H:i:s'), $state_url);
757
+ $wpdb->query($sqlInsertToken);
758
+ define('B2S_PLUGIN_TOKEN', $result->token);
759
+ } else {
760
+ define('B2S_PLUGIN_NOTICE', 'CONNECTION');
761
+ }
762
+ }
763
+ } else {
764
+ define('B2S_PLUGIN_TOKEN', $userExist->token);
765
+ }
766
+ }
767
+
768
+ public function getUserDetails() {
769
+ $tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . B2S_PLUGIN_BLOG_USER_ID);
770
+ if ($tokenInfo == false || !isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) || !isset($tokenInfo['B2S_PLUGIN_VERSION']) || $tokenInfo['B2S_PLUGIN_USER_VERSION_NEXT_REQUEST'] < time() || (isset($tokenInfo['B2S_PLUGIN_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_VERSION'] < (int) B2S_PLUGIN_VERSION) || (isset($tokenInfo['B2S_PLUGIN_TRAIL_END']) && strtotime($tokenInfo['B2S_PLUGIN_TRAIL_END']) < strtotime(gmdate('Y-m-d H:i:s')))) {
771
+ B2S_Tools::setUserDetails();
772
+ $this->checkUpdate();
773
+ } else {
774
+ define('B2S_PLUGIN_USER_VERSION', $tokenInfo['B2S_PLUGIN_USER_VERSION']);
775
+ if (isset($tokenInfo['B2S_PLUGIN_TRAIL_END'])) {
776
+ define('B2S_PLUGIN_TRAIL_END', $tokenInfo['B2S_PLUGIN_TRAIL_END']);
777
+ }
778
+ }
779
+ }
780
+
781
+ private function checkUpdate() {
782
+ $args = array(
783
+ 'timeout' => '15',
784
+ 'redirection' => '5',
785
+ 'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)"
786
+ );
787
+ $result = wp_remote_retrieve_body(wp_remote_get(B2S_PLUGIN_API_ENDPOINT . 'update.txt', $args));
788
+ $currentVersion = explode('#', $result);
789
+ if (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) {
790
+ define('B2S_PLUGIN_NOTICE', 'UPDATE');
791
+ }
792
+ }
793
+
794
+ public function createMenu() {
795
+ $subPages = array();
796
+ //pageTitle,menutitle,$capability, $menu_slug, $function, $icon_url, $position
797
+ add_menu_page('Blog2Social', 'Blog2Social', 'read', 'blog2social', null, plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE));
798
+ //$parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function
799
+ $subPages[] = add_submenu_page('blog2social', __('Dashboard', 'blog2social'), __('Dashboard', 'blog2social'), 'read', 'blog2social', array($this, 'b2sstart'));
800
+ $subPages[] = add_submenu_page('blog2social', __('Posts & Sharing', 'blog2social'), __('Posts & Sharing', 'blog2social'), 'read', 'blog2social-post', array($this, 'b2sPost'));
801
+ $subPages[] = add_submenu_page('blog2social', __('Calendar', 'blog2social'), __('Calendar', 'blog2social'), 'read', 'blog2social-calendar', array($this, 'b2sPostCalendar'));
802
+ $subPages[] = add_submenu_page('blog2social', __('Content Curation', 'blog2social'), __('Content Curation', 'blog2social'), 'read', 'blog2social-curation', array($this, 'b2sContentCuration'));
803
+ $subPages[] = add_submenu_page('blog2social', __('Networks', 'blog2social'), __('Networks', 'blog2social'), 'read', 'blog2social-network', array($this, 'b2sNetwork'));
804
+ $subPages[] = add_submenu_page('blog2social', __('Settings', 'blog2social'), __('Settings', 'blog2social'), 'read', 'blog2social-settings', array($this, 'b2sSettings'));
805
+ if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_PR_SERVICE', B2S_PLUGIN_ADMIN)) {
806
+ $subPages[] = add_submenu_page('blog2social', __('PR-Service', 'blog2social'), __('PR-Service', 'blog2social'), 'read', 'prg-post', array($this, 'prgPost'));
807
+ }
808
+ $subPages[] = add_submenu_page('blog2social', __('Help & Support', 'blog2social'), __('Help & Support', 'blog2social'), 'read', 'blog2social-support', array($this, 'b2sSupport'));
809
+ if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_LICENSE', B2S_PLUGIN_ADMIN)) {
810
+ $subPages[] = add_submenu_page('blog2social', __('Premium', 'blog2social'), '<span class="dashicons dashicons-star-filled"></span> ' . __('PREMIUM', 'blog2social'), 'read', 'blog2social-premium', array($this, 'b2sPremium'));
811
+ }
812
+ $subPages[] = add_submenu_page(null, 'B2S Post Draft', 'B2S Post Draft', 'read', 'blog2social-draft-post', array($this, 'b2sPostDraft'));
813
+ $subPages[] = add_submenu_page(null, 'B2S Post Sched', 'B2S Post Sched', 'read', 'blog2social-sched', array($this, 'b2sPostSched'));
814
+ $subPages[] = add_submenu_page(null, 'B2S Post Approve', 'B2S Post Approve', 'read', 'blog2social-approve', array($this, 'b2sPostApprove'));
815
+ $subPages[] = add_submenu_page(null, 'B2S Post Publish', 'B2S Post Publish', 'read', 'blog2social-publish', array($this, 'b2sPostPublish'));
816
+ $subPages[] = add_submenu_page(null, 'B2S Post Notice', 'B2S Post Notice', 'read', 'blog2social-notice', array($this, 'b2sPostNotice')); //Error post page since 4.8.0
817
+ $subPages[] = add_submenu_page(null, 'B2S Ship', 'B2S Ship', 'read', 'blog2social-ship', array($this, 'b2sShip'));
818
+ $subPages[] = add_submenu_page(null, 'B2S Curation Drafts', 'B2S Curation Drafts', 'read', 'blog2social-curation-draft', array($this, 'b2sCurationDraft'));
819
+ $subPages[] = add_submenu_page(null, 'PRG Login', 'PRG Login', 'read', 'prg-login', array($this, 'prgLogin'));
820
+ $subPages[] = add_submenu_page(null, 'PRG Ship', 'PRG Ship', 'read', 'prg-ship', array($this, 'prgShip'));
821
+ foreach ($subPages as $var) {
822
+ add_action($var, array($this, 'addAssets'));
823
+ }
824
+ }
825
+
826
+ public function createToolbarMenu() {
827
+ if (!current_user_can('edit_posts')) {
828
+ return;
829
+ }
830
+ global $wp_admin_bar;
831
+ $seo_url = strtolower(get_admin_url(null, 'admin.php?page='));
832
+ $title = '<div id="blog2social-ab-icon" class="ab-item" style="padding-left: 25px; background-repeat: no-repeat; background-size: 16px auto; background-position: left center; background-image: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\');">' . __('Blog2Social', 'blog2social') . '</div>';
833
+ $wp_admin_bar->add_node(array(
834
+ 'id' => 'blog2social',
835
+ 'title' => $title,
836
+ 'href' => $seo_url . 'blog2social'
837
+ ));
838
+
839
+ $wp_admin_bar->add_node(array(
840
+ 'id' => 'blog2social-dashboard',
841
+ 'title' => __('Dashboard', 'blog2social'),
842
+ 'href' => $seo_url . 'blog2social',
843
+ 'parent' => 'blog2social'
844
+ ));
845
+
846
+ $wp_admin_bar->add_node(array(
847
+ 'id' => 'blog2social-post',
848
+ 'title' => __('Posts & Sharing', 'blog2social'),
849
+ 'href' => $seo_url . 'blog2social-post',
850
+ 'parent' => 'blog2social'
851
+ ));
852
+
853
+ $wp_admin_bar->add_node(array(
854
+ 'id' => 'blog2social-calendar',
855
+ 'title' => __('Calendar', 'blog2social'),
856
+ 'href' => $seo_url . 'blog2social-calendar',
857
+ 'parent' => 'blog2social'
858
+ ));
859
+
860
+
861
+ $wp_admin_bar->add_node(array(
862
+ 'id' => 'blog2social-curation',
863
+ 'title' => __('Content Curation', 'blog2social'),
864
+ 'href' => $seo_url . 'blog2social-curation',
865
+ 'parent' => 'blog2social'
866
+ ));
867
+
868
+ $wp_admin_bar->add_node(array(
869
+ 'id' => 'blog2social-network',
870
+ 'title' => __('Networks', 'blog2social'),
871
+ 'href' => $seo_url . 'blog2social-network',
872
+ 'parent' => 'blog2social'
873
+ ));
874
+ $wp_admin_bar->add_node(array(
875
+ 'id' => 'blog2social-settings',
876
+ 'title' => __('Settings', 'blog2social'),
877
+ 'href' => $seo_url . 'blog2social-settings',
878
+ 'parent' => 'blog2social'
879
+ ));
880
+
881
+ if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_PR_SERVICE', B2S_PLUGIN_ADMIN)) {
882
+ $wp_admin_bar->add_node(array(
883
+ 'id' => 'blog2social-prg-post',
884
+ 'title' => __('PR-Service', 'blog2social'),
885
+ 'href' => $seo_url . 'prg-post',
886
+ 'parent' => 'blog2social'
887
+ ));
888
+ }
889
+
890
+ $wp_admin_bar->add_node(array(
891
+ 'id' => 'blog2social-support',
892
+ 'title' => __('Help & Support', 'blog2social'),
893
+ 'href' => $seo_url . 'blog2social-support',
894
+ 'parent' => 'blog2social'
895
+ ));
896
+
897
+ if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_LICENSE', B2S_PLUGIN_ADMIN)) {
898
+ $wp_admin_bar->add_node(array(
899
+ 'id' => 'blog2social-premium',
900
+ 'title' => '<span class="ab-icon dashicons dashicons-star-filled"></span> ' . __('PREMIUM', 'blog2social'),
901
+ 'href' => $seo_url . 'blog2social-premium',
902
+ 'parent' => 'blog2social'
903
+ ));
904
+ }
905
+ }
906
+
907
+ //PageFunktion
908
+ public function b2sstart() {
909
+
910
+ if (B2S_Tools::showNotice() == false) {
911
+ wp_enqueue_style('B2SFULLCALLENDARCSS');
912
+ wp_enqueue_style('B2SCALENDARCSS');
913
+ wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
914
+ wp_enqueue_script('B2SFULLCALENDARJS');
915
+ wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
916
+ wp_enqueue_script('B2SLIB');
917
+
918
+ wp_enqueue_script('B2SMOMENT');
919
+ wp_enqueue_script('B2SCHARTJS');
920
+ wp_enqueue_style('B2SSTARTCSS');
921
+ wp_enqueue_script('B2SSTARTJS');
922
+ wp_enqueue_style('B2SPOSTCSS');
923
+ wp_enqueue_script('B2SPOSTJS');
924
+ wp_enqueue_style('B2SAIRDATEPICKERCSS');
925
+ wp_enqueue_script('B2SAIRDATEPICKERJS');
926
+ wp_enqueue_script('B2SAIRDATEPICKERDEJS');
927
+ wp_enqueue_script('B2SAIRDATEPICKERENJS');
928
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/dashboard.php');
929
+ } else {
930
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
931
+ }
932
+ }
933
+
934
+ //PageFunktion
935
+ public function b2sPost() {
936
+ if (B2S_Tools::showNotice() == false) {
937
+ wp_enqueue_style('B2SPOSTCSS');
938
+ wp_enqueue_script('B2SPOSTJS');
939
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.php');
940
+ } else {
941
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
942
+ }
943
+ }
944
+
945
+ //Page Curation
946
+ public function b2sContentCuration() {
947
+ if (B2S_Tools::showNotice() == false) {
948
+ wp_enqueue_style('B2SCURATIONCSS');
949
+ wp_enqueue_script('B2SCURATIONJS');
950
+ wp_enqueue_style('B2SAIRDATEPICKERCSS');
951
+ wp_enqueue_script('B2SAIRDATEPICKERJS');
952
+ wp_enqueue_script('B2SAIRDATEPICKERDEJS');
953
+ wp_enqueue_script('B2SAIRDATEPICKERENJS');
954
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.php');
955
+ } else {
956
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
957
+ }
958
+ }
959
+
960
+ //PageFunktion
961
+ public function b2sNetwork() {
962
+ if (B2S_Tools::showNotice() == false) {
963
+ wp_enqueue_style('B2SNETWORKCSS');
964
+ wp_enqueue_script('B2SNETWORKJS');
965
+ wp_enqueue_style('B2STIMEPICKERCSS');
966
+ wp_enqueue_script('B2STIMEPICKERJS');
967
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/network.php');
968
+ } else {
969
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
970
+ }
971
+ }
972
+
973
+ //PageFunktion
974
+ public function b2sSettings() {
975
+ if (B2S_Tools::showNotice() == false) {
976
+ wp_enqueue_style('B2SSETTINGSCSS');
977
+ wp_enqueue_script('B2SSETTINGSJS');
978
+ wp_enqueue_style('B2STIMEPICKERCSS');
979
+ wp_enqueue_script('B2STIMEPICKERJS');
980
+ wp_enqueue_style('B2SBTNTOOGLECSS');
981
+ wp_enqueue_script('B2SBTNTOOGLEJS');
982
+ wp_enqueue_style('B2SCHOSENCSS');
983
+ wp_enqueue_script('B2SCHOSENJS');
984
+
985
+ if (current_user_can('upload_files')) {
986
+ //Capability by Super Admin ,Administrator ,Editor ,Author
987
+ wp_enqueue_media();
988
+ }
989
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/settings.php');
990
+ } else {
991
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
992
+ }
993
+ }
994
+
995
+ //PageFunktion
996
+ public function b2sShip() {
997
+ if (B2S_Tools::showNotice() == false) {
998
+
999
+ wp_enqueue_style('B2SFULLCALLENDARCSS');
1000
+ wp_enqueue_style('B2SCALENDARCSS');
1001
+ wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
1002
+ wp_enqueue_script('B2SFULLCALENDARJS');
1003
+ wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
1004
+ wp_enqueue_script('B2SLIB');
1005
+ wp_enqueue_style('B2SSHIPCSS');
1006
+ wp_enqueue_style('B2SDATEPICKERCSS');
1007
+ wp_enqueue_style('B2STIMEPICKERCSS');
1008
+ wp_enqueue_style('B2SWYSIWYGCSS');
1009
+ wp_enqueue_script('B2SWYSIWYGJS');
1010
+ if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
1011
+ wp_enqueue_script('B2SWYSIWYGLANGDEJS');
1012
+ } else {
1013
+ wp_enqueue_script('B2SWYSIWYGLANGENJS');
1014
+ }
1015
+ wp_enqueue_script('B2SDATEPICKERJS');
1016
+ wp_enqueue_script('B2SDATEPICKERDEJS');
1017
+ wp_enqueue_script('B2SDATEPICKERENJS');
1018
+ wp_enqueue_script('B2STIMEPICKERJS');
1019
+ wp_enqueue_script('B2SSHIPJS');
1020
+ if (current_user_can('upload_files')) {
1021
+ //Capability by Super Admin ,Administrator ,Editor ,Author
1022
+ wp_enqueue_media();
1023
+ }
1024
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/ship.php');
1025
+ } else {
1026
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1027
+ }
1028
+ }
1029
+
1030
+ //PageFunktion
1031
+ public function b2sCurationDraft() {
1032
+ if (B2S_Tools::showNotice() == false) {
1033
+ wp_enqueue_style('B2SCURATIONDRAFTCSS');
1034
+ wp_enqueue_script('B2SCURATIONDRAFTJS');
1035
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.draft.php');
1036
+ } else {
1037
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1038
+ }
1039
+ }
1040
+
1041
+ //PageFunktion
1042
+ public function prgLogin() {
1043
+ if (B2S_Tools::showNotice() == false) {
1044
+ $prgInfo = get_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
1045
+ if ($prgInfo != false && isset($prgInfo['B2S_PRG_ID']) && (int) $prgInfo['B2S_PRG_ID'] > 0 && isset($prgInfo['B2S_PRG_TOKEN']) && !empty($prgInfo['B2S_PRG_TOKEN'])) {
1046
+ $postId = (int) $_GET['postId'];
1047
+ echo'<script> window.location="' . admin_url('/admin.php?page=prg-ship&postId=' . $postId, 'http') . '"; </script> ';
1048
+ //wp_redirect(admin_url('/admin.php?page=prg-ship&postId=' . $postId, 'http'), 301);
1049
+ wp_die();
1050
+ } else {
1051
+ wp_enqueue_style('PRGLOGINCSS');
1052
+ wp_enqueue_script('PRGLOGINJS');
1053
+ require_once( B2S_PLUGIN_DIR . 'views/prg/login.php');
1054
+ }
1055
+ } else {
1056
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1057
+ }
1058
+ }
1059
+
1060
+ //PageFunktion
1061
+ public function prgShip() {
1062
+ if (B2S_Tools::showNotice() == false) {
1063
+ wp_enqueue_style('PRGSHIPCSS');
1064
+ wp_enqueue_script('PRGSHIPJS');
1065
+ wp_enqueue_script('PRGGENERALJS');
1066
+ require_once( B2S_PLUGIN_DIR . 'views/prg/ship.php');
1067
+ } else {
1068
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1069
+ }
1070
+ }
1071
+
1072
+ //PageFunktion
1073
+ public function b2sPostSched() {
1074
+ if (B2S_Tools::showNotice() == false) {
1075
+ wp_enqueue_script('B2SLIB');
1076
+ wp_enqueue_style('B2SPOSTSCHEDCSS');
1077
+ wp_enqueue_style('B2SDATEPICKERCSS');
1078
+ wp_enqueue_style('B2STIMEPICKERCSS');
1079
+ wp_enqueue_script('B2SDATEPICKERJS');
1080
+ wp_enqueue_script('B2SDATEPICKERDEJS');
1081
+ wp_enqueue_script('B2SDATEPICKERENJS');
1082
+ wp_enqueue_script('B2STIMEPICKERJS');
1083
+ wp_enqueue_script('B2SPOSTJS');
1084
+ wp_enqueue_style('B2SWYSIWYGCSS');
1085
+ wp_enqueue_script('B2SWYSIWYGJS');
1086
+ wp_enqueue_script('B2SSHIPJS');
1087
+ if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
1088
+ wp_enqueue_script('B2SWYSIWYGLANGDEJS');
1089
+ } else {
1090
+ wp_enqueue_script('B2SWYSIWYGLANGENJS');
1091
+ }
1092
+ if (current_user_can('upload_files')) {
1093
+ //Capability by Super Admin ,Administrator ,Editor ,Author
1094
+ wp_enqueue_media();
1095
+ }
1096
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.sched.php');
1097
+ } else {
1098
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1099
+ }
1100
+ }
1101
+
1102
+ //PageFunktion
1103
+ public function b2sPostApprove() {
1104
+ if (B2S_Tools::showNotice() == false) {
1105
+ wp_enqueue_style('B2SPOSTAPPROVECSS');
1106
+ wp_enqueue_script('B2SPOSTJS');
1107
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.approve.php');
1108
+ } else {
1109
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1110
+ }
1111
+ }
1112
+
1113
+ //PageFunktion
1114
+ public function b2sPostDraft() {
1115
+ if (B2S_Tools::showNotice() == false) {
1116
+ wp_enqueue_style('B2SPOSTDRAFTCSS');
1117
+ wp_enqueue_script('B2SPOSTJS');
1118
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.draft.php');
1119
+ } else {
1120
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1121
+ }
1122
+ }
1123
+
1124
+ //PageFunktion
1125
+ public function b2sPostCalendar() {
1126
+ if (B2S_Tools::showNotice() == false) {
1127
+ wp_enqueue_script('B2SLIB');
1128
+ wp_enqueue_style('B2SFULLCALLENDARCSS');
1129
+ wp_enqueue_style('B2SCALENDARCSS');
1130
+ wp_enqueue_style('B2SDATEPICKERCSS');
1131
+ wp_enqueue_style('B2STIMEPICKERCSS');
1132
+ wp_enqueue_script('B2SDATEPICKERJS');
1133
+ wp_enqueue_script('B2SDATEPICKERDEJS');
1134
+ wp_enqueue_script('B2SDATEPICKERENJS');
1135
+ wp_enqueue_script('B2STIMEPICKERJS');
1136
+ wp_enqueue_script('B2SCALENDARJS');
1137
+ wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
1138
+ wp_enqueue_script('B2SFULLCALENDARJS');
1139
+ wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
1140
+ wp_enqueue_style('B2SWYSIWYGCSS');
1141
+ wp_enqueue_script('B2SWYSIWYGJS');
1142
+ wp_enqueue_script('B2SSHIPJS');
1143
+ if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
1144
+ wp_enqueue_script('B2SWYSIWYGLANGDEJS');
1145
+ } else {
1146
+ wp_enqueue_script('B2SWYSIWYGLANGENJS');
1147
+ }
1148
+
1149
+ if (current_user_can('upload_files')) {
1150
+ //Capability by Super Admin ,Administrator ,Editor ,Author
1151
+ wp_enqueue_media();
1152
+ }
1153
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.calendar.php');
1154
+ } else {
1155
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1156
+ }
1157
+ }
1158
+
1159
+ //PageFunktion
1160
+ public function b2sSupport() {
1161
+ wp_enqueue_style('B2SSUPPORT');
1162
+ wp_enqueue_script('B2SSUPPORTJS');
1163
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/support.php');
1164
+ }
1165
+
1166
+ //PageFunktion
1167
+ public function b2sPremium() {
1168
+ wp_enqueue_style('B2SPREMIUM');
1169
+ wp_enqueue_style('B2SCHOSENCSS');
1170
+ wp_enqueue_script('B2SCHOSENJS');
1171
+ wp_enqueue_script('B2SPREMIUMJS');
1172
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/premium.php');
1173
+ }
1174
+
1175
+ //PageFunktion
1176
+ public function b2sPostPublish() {
1177
+ if (B2S_Tools::showNotice() == false) {
1178
+ wp_enqueue_style('B2SPOSTPUBLISHCSS');
1179
+ wp_enqueue_script('B2SPOSTJS');
1180
+ wp_enqueue_script('PRGGENERALJS');
1181
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.publish.php');
1182
+ } else {
1183
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1184
+ }
1185
+ }
1186
+
1187
+ //PageFunktion
1188
+ public function b2sPostNotice() {
1189
+ if (B2S_Tools::showNotice() == false) {
1190
+ wp_enqueue_style('B2SPOSTNOTICECSS');
1191
+ wp_enqueue_script('B2SPOSTJS');
1192
+ wp_enqueue_script('PRGGENERALJS');
1193
+ require_once( B2S_PLUGIN_DIR . 'views/b2s/post.notice.php');
1194
+ } else {
1195
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1196
+ }
1197
+ }
1198
+
1199
+ //PageFunktion
1200
+ public function prgPost() {
1201
+ if (B2S_Tools::showNotice() == false) {
1202
+ wp_enqueue_style('PRGPOSTCSS');
1203
+ wp_enqueue_script('PRGPOSTJS');
1204
+ wp_enqueue_script('PRGGENERALJS');
1205
+ require_once( B2S_PLUGIN_DIR . 'views/prg/post.php');
1206
+ } else {
1207
+ require_once( B2S_PLUGIN_DIR . 'views/notice.php');
1208
+ }
1209
+ }
1210
+
1211
+ public function addBootAssets($hook) {
1212
+ wp_enqueue_script('B2SVALIDATEJS');
1213
+ if ($hook == 'edit.php') {
1214
+ wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
1215
+ }
1216
+
1217
+ if ($hook == 'plugins.php') {
1218
+ wp_enqueue_script('B2SPLUGINDEACTIVATEJS');
1219
+ wp_enqueue_style('B2SPLUGINDEACTIVATECSS');
1220
+ }
1221
+ }
1222
+
1223
+ public function addAssets() {
1224
+ wp_enqueue_style('B2SBOOTCSS');
1225
+ wp_enqueue_script('B2SBOOTJS');
1226
+ wp_enqueue_script('B2SGENERALJS');
1227
+ }
1228
+
1229
+ public function registerAssets() {
1230
+ wp_register_style('B2SBOOTCSS', plugins_url('assets/css/general.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1231
+ wp_register_style('B2SSTARTCSS', plugins_url('assets/css/b2s/start.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1232
+ wp_register_style('B2SPOSTCSS', plugins_url('assets/css/b2s/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1233
+ wp_register_style('B2SSHIPCSS', plugins_url('assets/css/b2s/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1234
+ wp_register_style('B2SCURATIONCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1235
+
1236
+ wp_register_style('B2SPOSTSCHEDCSS', plugins_url('assets/css/b2s/post.sched.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1237
+ wp_register_style('B2SPOSTDRAFTCSS', plugins_url('assets/css/b2s/post.draft.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1238
+ wp_register_style('B2SPOSTAPPROVECSS', plugins_url('assets/css/b2s/post.approve.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1239
+ wp_register_style('B2SPOSTPUBLISHCSS', plugins_url('assets/css/b2s/post.publish.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1240
+ wp_register_style('B2SPOSTNOTICECSS', plugins_url('assets/css/b2s/post.notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1241
+ wp_register_style('B2SNETWORKCSS', plugins_url('assets/css/b2s/network.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1242
+ wp_register_style('B2SSUPPORT', plugins_url('assets/css/b2s/support.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1243
+ wp_register_style('B2SPREMIUM', plugins_url('assets/css/b2s/premium.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1244
+ wp_register_style('B2SSETTINGSCSS', plugins_url('assets/css/b2s/settings.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1245
+ wp_register_style('PRGSHIPCSS', plugins_url('assets/css/prg/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1246
+ wp_register_style('PRGLOGINCSS', plugins_url('assets/css/prg/login.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1247
+ wp_register_style('B2SDATEPICKERCSS', plugins_url('assets/lib/datepicker/css/bootstrap-datepicker3.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1248
+ wp_register_style('B2SAIRDATEPICKERCSS', plugins_url('assets/lib/air-datepicker/css/datepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1249
+ wp_register_style('B2STIMEPICKERCSS', plugins_url('assets/lib/timepicker/timepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1250
+ wp_register_style('PRGPOSTCSS', plugins_url('assets/css/prg/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1251
+ wp_register_style('B2SWYSIWYGCSS', plugins_url('assets/lib/wysiwyg/square.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1252
+ wp_register_style('B2SPOSTBOXCSS', plugins_url('assets/css/b2s/wp/post-box.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1253
+ wp_register_style('B2SNOTICECSS', plugins_url('assets/css/notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1254
+ wp_register_style('B2SFULLCALLENDARCSS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1255
+ wp_register_style('B2SCALENDARCSS', plugins_url('assets/css/b2s/calendar.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1256
+ wp_register_style('B2SBTNTOOGLECSS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1257
+ wp_register_style('B2SCHOSENCSS', plugins_url('assets/lib/chosen/chosen.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1258
+ wp_register_style('B2SPLUGINDEACTIVATECSS', plugins_url('assets/css/b2s/wp/plugin-deactivate.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1259
+ wp_register_style('B2SCURATIONDRAFTCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1260
+
1261
+ wp_register_script('B2SNETWORKJS', plugins_url('assets/js/b2s/network.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1262
+ wp_register_script('B2SSETTINGSJS', plugins_url('assets/js/b2s/settings.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1263
+ wp_register_script('B2SSTARTJS', plugins_url('assets/js/b2s/start.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1264
+ wp_register_script('B2SPOSTJS', plugins_url('assets/js/b2s/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1265
+ wp_register_script('B2SSHIPJS', plugins_url('assets/js/b2s/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1266
+ wp_register_script('B2SCURATIONJS', plugins_url('assets/js/b2s/curation.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1267
+ wp_register_script('PRGSHIPJS', plugins_url('assets/js/prg/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1268
+ wp_register_script('PRGLOGINJS', plugins_url('assets/js/prg/login.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1269
+ wp_register_script('B2SBOOTJS', plugins_url('assets/js/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1270
+ wp_register_script('B2SVALIDATEJS', plugins_url('assets/js/validate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1271
+
1272
+ wp_register_script('B2SSUPPORTJS', plugins_url('assets/js/b2s/support.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1273
+ wp_register_script('B2SGENERALJS', plugins_url('assets/js/b2s/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1274
+ wp_register_script('B2SDATEPICKERJS', plugins_url('assets/lib/datepicker/js/bootstrap-datepicker.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1275
+ wp_register_script('B2SDATEPICKERDEJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.de_DE.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1276
+ wp_register_script('B2SDATEPICKERENJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.en_US.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1277
+ wp_register_script('B2SAIRDATEPICKERJS', plugins_url('assets/lib/air-datepicker/js/datepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1278
+ wp_register_script('B2SAIRDATEPICKERDEJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1279
+ wp_register_script('B2SAIRDATEPICKERENJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1280
+ wp_register_script('B2SCHARTJS', plugins_url('assets/lib/chartjs/Chart.bundle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1281
+ wp_register_script('B2SMOMENT', plugins_url('assets/lib/moment/moment-with-locales.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1282
+ wp_register_script('B2STIMEPICKERJS', plugins_url('assets/lib/timepicker/timepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1283
+ wp_register_script('B2SNOTICEJS', plugins_url('assets/js/notice.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1284
+ wp_register_script('PRGPOSTJS', plugins_url('assets/js/prg/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1285
+ wp_register_script('PRGGENERALJS', plugins_url('assets/js/prg/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1286
+ wp_register_script('B2SWYSIWYGJS', plugins_url('assets/lib/wysiwyg/jquery.sceditor.xhtml.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1287
+ wp_register_script('B2SWYSIWYGLANGDEJS', plugins_url('assets/lib/wysiwyg/languages/de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1288
+ wp_register_script('B2SWYSIWYGLANGENJS', plugins_url('assets/lib/wysiwyg/languages/en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1289
+ wp_register_script('B2SPOSTBOXJS', plugins_url('assets/js/b2s/wp/post-box.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1290
+ wp_register_script('B2SPOSTSCHEDHEARTBEATJS', plugins_url('assets/js/b2s/wp/post-sched-heartbeat.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1291
+ wp_register_script('B2SCALENDARJS', plugins_url('assets/js/b2s/calendar.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1292
+ wp_register_script('B2SFULLCALENDARMOMENTJS', plugins_url('assets/lib/fullcalendar/lib/moment.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1293
+ wp_register_script('B2SFULLCALENDARJS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1294
+ wp_register_script('B2SFULLCALENDARLOCALEJS', plugins_url('assets/lib/fullcalendar/locale-all.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1295
+ wp_register_script('B2SBTNTOOGLEJS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1296
+ wp_register_script('B2SCHOSENJS', plugins_url('assets/lib/chosen/chosen.jquery.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1297
+ wp_register_script('B2SLIB', plugins_url('assets/js/b2s/lib.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1298
+ wp_register_script('B2SPLUGINDEACTIVATEJS', plugins_url('assets/js/b2s/wp/plugin-deactivate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1299
+ wp_register_script('B2SCURATIONDRAFTJS', plugins_url('assets/js/b2s/curation.draft.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1300
+ wp_register_script('B2SPREMIUMJS', plugins_url('assets/js/b2s/premium.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
1301
+ }
1302
+
1303
+ public function activatePlugin() {
1304
+ require_once (B2S_PLUGIN_DIR . 'includes/System.php');
1305
+ require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1306
+ $b2sSystem = new B2S_System();
1307
+ $b2sCheckBefore = $b2sSystem->check('before');
1308
+ if (is_array($b2sCheckBefore)) {
1309
+ $b2sSystem->deactivatePlugin();
1310
+ wp_die($b2sSystem->getErrorMessage($b2sCheckBefore) . ' ' . __('or', 'blog2social') . ' <a href="' . admin_url("/plugins.php", "http") . '/">' . __('back to install plugins', 'blog2social') . '</a>');
1311
+ }
1312
+
1313
+ global $wpdb;
1314
+ //Start Old Plugin
1315
+ $sqlDeleteFirst = 'DROP TABLE IF EXISTS `prg_connect_sent`';
1316
+ $wpdb->query($sqlDeleteFirst);
1317
+ $sqlDeleteSecond = 'DROP TABLE IF EXISTS `prg_connect_config`';
1318
+ $wpdb->query($sqlDeleteSecond);
1319
+ //END Old Plugin
1320
+ $sqlCreateUser = "CREATE TABLE IF NOT EXISTS `b2s_user` (
1321
+ `id` int(11) NOT NULL AUTO_INCREMENT,
1322
+ `token` varchar(255) NOT NULL,
1323
+ `blog_user_id` int(11) NOT NULL,
1324
+ `feature` TINYINT(2) NOT NULL,
1325
+ `state_url` TINYINT(2) NOT NULL,
1326
+ `register_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1327
+ PRIMARY KEY (`id`), INDEX `blog_user_id` (`blog_user_id`), INDEX `token` (`token`), INDEX `feature` (`feature`)
1328
+ ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;";
1329
+ $wpdb->query($sqlCreateUser);
1330
+
1331
+ $b2sUserCols = $wpdb->get_results('SHOW COLUMNS FROM b2s_user');
1332
+ if (is_array($b2sUserCols) && isset($b2sUserCols[0])) {
1333
+ $b2sUserColsData = array();
1334
+ foreach ($b2sUserCols as $key => $value) {
1335
+ if (isset($value->Field) && !empty($value->Field)) {
1336
+ $b2sUserColsData[] = $value->Field;
1337
+ }
1338
+ }
1339
+ if (!in_array("register_date", $b2sUserColsData)) {
1340
+ $wpdb->query("ALTER TABLE b2s_user ADD register_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
1341
+ }
1342
+ if (!in_array("state_url", $b2sUserColsData)) {
1343
+ $wpdb->query("ALTER TABLE b2s_user ADD state_url TINYINT(2) NOT NULL DEFAULT '1'");
1344
+ }
1345
+ }
1346
+
1347
+ //Notice Rating - stop rating remember again
1348
+ //$wpdb->query('UPDATE `b2s_user` SET `feature` = 0');
1349
+
1350
+ $keys = $wpdb->get_results('SHOW INDEX FROM `b2s_user`');
1351
+ $allowIndexUser = array('PRIMARY', 'blog_user_id', 'token', 'feature');
1352
+ foreach ($keys as $k => $value) {
1353
+ if (!in_array($value->Key_name, $allowIndexUser)) {
1354
+ $wpdb->query('ALTER TABLE `b2s_user` DROP INDEX ' . $value->Key_name);
1355
+ }
1356
+ }
1357
+
1358
+ $sqlCreateUserPosts = "CREATE TABLE IF NOT EXISTS `b2s_posts` (
1359
+ `id` int(11) NOT NULL AUTO_INCREMENT,
1360
+ `post_id` int(11) NOT NULL,
1361
+ `blog_user_id` int(11) NOT NULL,
1362
+ `last_edit_blog_user_id` int(11) NOT NULL,
1363
+ `user_timezone` TINYINT NOT NULL DEFAULT '0',
1364
+ `sched_details_id` INT NOT NULL,
1365
+ `sched_type` TINYINT NOT NULL DEFAULT '0',
1366
+ `sched_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1367
+ `sched_date_utc` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1368
+ `publish_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1369
+ `publish_link` varchar(255) NOT NULL,
1370
+ `publish_error_code` varchar(100) NOT NULL,
1371
+ `network_details_id` int(11) NOT NULL,
1372
+ `post_for_relay` TINYINT NOT NULL DEFAULT '0',
1373
+ `post_for_approve` TINYINT NOT NULL DEFAULT '0',
1374
+ `relay_primary_post_id` int(11) NOT NULL DEFAULT '0',
1375
+ `relay_delay_min` int(11) NOT NULL DEFAULT '0',
1376
+ `hook_action` TINYINT NOT NULL DEFAULT '0',
1377
+ `hide` TINYINT NOT NULL DEFAULT '0',
1378
+ `v2_id` int(11) NOT NULL DEFAULT '0',
1379
+ PRIMARY KEY (`id`), INDEX `post_id` (`post_id`), INDEX `blog_user_id` (`blog_user_id`) , INDEX `sched_details_id` (`sched_details_id`),
1380
+ INDEX `sched_date` (`sched_date`), INDEX `sched_date_utc` (`sched_date_utc`), INDEX `publish_date` (`publish_date`) , INDEX `relay_primary_post_id` (`relay_primary_post_id`) ,
1381
+ INDEX `hook_action` (`hook_action`), INDEX `hide` (`hide`)
1382
+ ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
1383
+ $wpdb->query($sqlCreateUserPosts);
1384
+
1385
+ //since V4.8.0
1386
+ $b2sPostsCols = $wpdb->get_results('SHOW COLUMNS FROM b2s_posts');
1387
+ if (is_array($b2sPostsCols) && isset($b2sPostsCols[0])) {
1388
+ $b2sPostsColsData = array();
1389
+ foreach ($b2sPostsCols as $key => $value) {
1390
+ if (isset($value->Field) && !empty($value->Field)) {
1391
+ $b2sPostsColsData[] = $value->Field;
1392
+ }
1393
+ }
1394
+ if (!in_array("last_edit_blog_user_id", $b2sPostsColsData)) {
1395
+ $wpdb->query("ALTER TABLE b2s_posts ADD last_edit_blog_user_id INT NOT NULL DEFAULT '0'");
1396
+ }
1397
+ if (!in_array("post_for_relay", $b2sPostsColsData)) {
1398
+ $wpdb->query("ALTER TABLE b2s_posts ADD post_for_relay TINYINT NOT NULL DEFAULT '0'");
1399
+ }
1400
+ if (!in_array("post_for_approve", $b2sPostsColsData)) {
1401
+ $wpdb->query("ALTER TABLE b2s_posts ADD post_for_approve TINYINT NOT NULL DEFAULT '0'");
1402
+ }
1403
+ if (!in_array("relay_primary_post_id", $b2sPostsColsData)) {
1404
+ $wpdb->query("ALTER TABLE b2s_posts ADD relay_primary_post_id int(11) NOT NULL DEFAULT '0'");
1405
+ $wpdb->query('ALTER TABLE `b2s_posts` ADD INDEX(`relay_primary_post_id`)');
1406
+ }
1407
+ if (!in_array("relay_delay_min", $b2sPostsColsData)) {
1408
+ $wpdb->query("ALTER TABLE b2s_posts ADD relay_delay_min int(11) NOT NULL DEFAULT '0'");
1409
+ }
1410
+ }
1411
+
1412
+ $keys = $wpdb->get_results('SHOW INDEX FROM `b2s_posts`');
1413
+ $allowIndexPosts = array('PRIMARY', 'post_id', 'blog_user_id', 'sched_details_id', 'sched_date', 'sched_date_utc', 'publish_date', 'relay_primary_post_id', 'hook_action', 'hide');
1414
+ foreach ($keys as $k => $value) {
1415
+ if (!in_array($value->Key_name, $allowIndexPosts)) {
1416
+ $wpdb->query('ALTER TABLE `b2s_posts` DROP INDEX ' . $value->Key_name);
1417
+ }
1418
+ }
1419
+
1420
+ //Change Collation >=V4.0 Emoji
1421
+ $existsTable = $wpdb->get_results('SHOW TABLES LIKE "b2s_posts_sched_details"');
1422
+ if (is_array($existsTable) && !empty($existsTable)) {
1423
+ $wpdb->query('ALTER TABLE `b2s_posts_sched_details` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
1424
+ $wpdb->query('ALTER TABLE `b2s_posts_sched_details` CHANGE sched_data sched_data TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
1425
+ $wpdb->query('REPAIR TABLE `b2s_posts_sched_details`');
1426
+ $wpdb->query('OPTIMIZE TABLE `b2s_posts_sched_details`');
1427
+ } else {
1428
+ $sqlCreateUserSchedDetails = "CREATE TABLE IF NOT EXISTS `b2s_posts_sched_details` (
1429
+ `id` int(11) NOT NULL AUTO_INCREMENT,
1430
+ `sched_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
1431
+ `image_url` varchar(255) NOT NULL,
1432
+ PRIMARY KEY (`id`)
1433
+ ) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1 ;";
1434
+ $wpdb->query($sqlCreateUserSchedDetails);
1435
+ }
1436
+
1437
+ $sqlCreateUserNetworkDetails = "CREATE TABLE IF NOT EXISTS `b2s_posts_network_details` (
1438
+ `id` int(11) NOT NULL AUTO_INCREMENT,
1439
+ `network_id` TINYINT NOT NULL,
1440
+ `network_type` TINYINT NOT NULL,
1441
+ `network_auth_id` int(11) NOT NULL,
1442
+ `network_display_name` varchar(100) NOT NULL,
1443
+ PRIMARY KEY (`id`)
1444
+ ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
1445
+ $wpdb->query($sqlCreateUserNetworkDetails);
1446
+
1447
+ $sqlCreateUserContact = "CREATE TABLE IF NOT EXISTS `b2s_user_contact`(
1448
+ `id` int(5) NOT NULL AUTO_INCREMENT ,
1449
+ `blog_user_id` int(11) NOT NULL ,
1450
+ `name_mandant` varchar(100) NOT NULL ,
1451
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1452
+ `name_presse` varchar(100) NOT NULL ,
1453
+ `anrede_presse` enum('0','1','2') NOT NULL DEFAULT '0' COMMENT '0=Frau,1=Herr 2=keine Angabe',
1454
+ `vorname_presse` varchar(50) NOT NULL ,
1455
+ `nachname_presse` varchar(50) NOT NULL ,
1456
+ `strasse_presse` varchar(100) NOT NULL ,
1457
+ `nummer_presse` varchar(5) NOT NULL DEFAULT '',
1458
+ `plz_presse` varchar(10) NOT NULL ,
1459
+ `ort_presse` varchar(75) NOT NULL ,
1460
+ `land_presse` varchar(3) NOT NULL DEFAULT 'DE',
1461
+ `email_presse` varchar(75) NOT NULL ,
1462
+ `telefon_presse` varchar(30) NOT NULL ,
1463
+ `fax_presse` varchar(30) NOT NULL ,
1464
+ `url_presse` varchar(150) NOT NULL ,
1465
+ PRIMARY KEY (`id`) ,
1466
+ KEY `blog_user_id`(`blog_user_id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1";
1467
+ $wpdb->query($sqlCreateUserContact);
1468
+
1469
+
1470
+ $sqlCreateNetworkSettings = 'CREATE TABLE IF NOT EXISTS `b2s_user_network_settings` (
1471
+ `id` int(11) NOT NULL AUTO_INCREMENT,
1472
+ `blog_user_id` int(11) NOT NULL,
1473
+ `mandant_id` int(11) NOT NULL,
1474
+ `network_auth_id` int(11) NOT NULL,
1475
+ PRIMARY KEY (`id`),
1476
+ INDEX `blog_user_id` (`blog_user_id`), INDEX `mandant_id` (`mandant_id`)
1477
+ ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;';
1478
+ $wpdb->query($sqlCreateNetworkSettings);
1479
+
1480
+
1481
+ $sqlCreateDrafts = "CREATE TABLE IF NOT EXISTS `b2s_posts_drafts` (
1482
+ `id` int(11) NOT NULL AUTO_INCREMENT,
1483
+ `last_save_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1484
+ `blog_user_id` int(11) NOT NULL,
1485
+ `post_id` int(11) NOT NULL,
1486
+ `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
1487
+ PRIMARY KEY (`id`),
1488
+ INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
1489
+ ) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
1490
+ $wpdb->query($sqlCreateDrafts);
1491
+
1492
+
1493
+ /*
1494
+ * SET SAFETY AUTO-INCREMENT
1495
+ */
1496
+
1497
+ $wpdb->query("ALTER TABLE `b2s_posts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1498
+ $wpdb->query("ALTER TABLE `b2s_posts_sched_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1499
+ $wpdb->query("ALTER TABLE `b2s_posts_network_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1500
+ $wpdb->query("ALTER TABLE `b2s_user` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1501
+ $wpdb->query("ALTER TABLE `b2s_user_contact` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1502
+ $wpdb->query("ALTER TABLE `b2s_user_network_settings` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1503
+ $wpdb->query("ALTER TABLE `b2s_posts_drafts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
1504
+
1505
+ $b2sCheckAfter = $b2sSystem->check('after');
1506
+ if (is_array($b2sCheckAfter)) {
1507
+ $b2sSystem->deactivatePlugin();
1508
+ wp_die($b2sSystem->getErrorMessage($b2sCheckAfter) . ' ' . __('or', 'blog2social') . ' <a href="' . admin_url("/plugins.php", "http") . '/">' . __('back to install plugins', 'blog2social') . '</a>');
1509
+ }
1510
+
1511
+ //Activate Social Meta Tags
1512
+ $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
1513
+ if ($options->_getOption('og_active') === false || $options->_getOption('card_active') === false) {
1514
+ $options->_setOption('og_active', 1);
1515
+ $options->_setOption('card_active', 1);
1516
+ }
1517
+ }
1518
+
1519
+ public function deactivatePlugin() {
1520
+ $optionDeleteSchedPosts = get_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
1521
+ if ($optionDeleteSchedPosts !== false && (int) $optionDeleteSchedPosts == 1) {
1522
+ global $wpdb;
1523
+ $sqlPosts = "SELECT a.token FROM `b2s_user` a INNER JOIN b2s_posts ON a.`blog_user_id` = b2s_posts.`blog_user_id` where b2s_posts.`hide` = 0 AND b2s_posts.`sched_type` != 3 AND b2s_posts.`publish_date`= '0000-00-00 00:00:00' GROUP by a.blog_user_id";
1524
+ $results = $wpdb->get_results($sqlPosts, ARRAY_A);
1525
+ if (is_array($results) && !empty($results)) {
1526
+ $tempData = array('action' => 'deleteBlogSchedPost', 'host' => get_site_url(), 'data' => serialize($results));
1527
+ $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
1528
+ if (isset($result->result) && $result->result == true) {
1529
+ $data = array('hide' => '1', 'hook_action' => '0');
1530
+ $where = array('publish_date' => '0000-00-00 00:00:00', 'hide' => '0');
1531
+ $wpdb->update('b2s_posts', $data, $where, array('%d', '%d'), array('%d', '%d'));
1532
+ delete_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
1533
+ }
1534
+ }
1535
+ }
1536
+ }
1537
+
1538
+ public function releaseLocks() {
1539
+ require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1540
+ $options = new B2S_Options(get_current_user_id());
1541
+ $lock = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
1542
+
1543
+ if ($lock) {
1544
+ delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $lock);
1545
+ $options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", false);
1546
+ }
1547
+ }
1548
+
1549
+ }
includes/System.php CHANGED
@@ -92,4 +92,44 @@ class B2S_System {
92
  deactivate_plugins(B2S_PLUGIN_BASENAME);
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
92
  deactivate_plugins(B2S_PLUGIN_BASENAME);
93
  }
94
 
95
+ //V5.7.0 White-Label-Solution
96
+ public static function isblockedArea($area = '', $isAdmin = false, $general = false) {
97
+ if (defined('B2S_PLUGIN_WHITE_LABEL')) {
98
+ if (B2S_PLUGIN_WHITE_LABEL === true) {
99
+ if ($general) {
100
+ return true;
101
+ }
102
+ if (defined('B2S_PLUGIN_WHITE_LABEL_BLOCKED_AREA')) {
103
+ $blocked = unserialize(B2S_PLUGIN_WHITE_LABEL_BLOCKED_AREA);
104
+ if (is_array($blocked) && !empty($blocked)) {
105
+ if (in_array(trim($area), $blocked)) {
106
+ if ((trim($area) == 'B2S_LICENSE_MODUL_EDIT' || trim($area) == 'B2S_MENU_ITEM_LICENSE') && $isAdmin) {
107
+ return false;
108
+ }
109
+ return true;
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ return false;
116
+ }
117
+
118
+ //V5.7.0 White-Label-Solution
119
+ public static function customizeArea() {
120
+ if (defined('B2S_PLUGIN_WHITE_LABEL')) {
121
+ if (B2S_PLUGIN_WHITE_LABEL === true) {
122
+ if (defined('B2S_PLUGIN_WHITE_LABEL_LOGO')) {
123
+ if (!empty(B2S_PLUGIN_WHITE_LABEL_LOGO)) {
124
+ $file = get_home_path() . B2S_PLUGIN_WHITE_LABEL_LOGO;
125
+ if (file_exists($file)) {
126
+ return array('image_path' => $file);
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ return false;
133
+ }
134
+
135
  }
includes/Tools.php CHANGED
@@ -243,5 +243,9 @@ class B2S_Tools {
243
  }
244
  return $options;
245
  }
 
 
 
 
246
 
247
  }
243
  }
244
  return $options;
245
  }
246
+
247
+
248
+
249
+
250
 
251
  }
languages/blog2social-de_DE.mo CHANGED
Binary file
languages/blog2social-de_DE.po CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the same license as the Plugins - Blog2Social: Social Media Auto Post &amp; Scheduler - Stable (latest release) package.
3
  msgid ""
4
  msgstr ""
5
- "PO-Revision-Date: 2019-07-30 07:10+0000\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
@@ -11,10 +11,10 @@ msgstr ""
11
  "Language: de_DE\n"
12
  "Project-Id-Version: Plugins - Blog2Social: Social Media Auto Post &amp; Scheduler - Stable (latest release)\n"
13
  "Report-Msgid-Bugs-To: \n"
14
- "POT-Creation-Date: 2019-07-30 07:04+0000\n"
15
  "Last-Translator: admin <s.buerger@adenion.de>\n"
16
  "Language-Team: German\n"
17
- "X-Loco-Version: 2.2.2; wp-5.2.3-alpha-45666"
18
 
19
  #: includes/Loader.php:44
20
  msgid "Modify pin board"
@@ -32,207 +32,215 @@ msgstr "Modify subreddit"
32
  msgid "Modify forum"
33
  msgstr "Modify forum"
34
 
35
- #: includes/Loader.php:364
36
  msgid "Auto-Post on Social Media"
37
  msgstr "Automatisch auf Social Media teilen"
38
 
39
- #: includes/Loader.php:365
40
  msgid "Social Media Content Calendar"
41
  msgstr "Social Media Kalender"
42
 
43
- #: includes/Loader.php:669
44
  msgid "This post will be shared into your social media from"
45
  msgstr "Dein Beitrag ist zur Veröffentlichung in den Social Media geplant ab dem"
46
 
47
- #: includes/Loader.php:669 includes/Loader.php:671
48
  msgid "show details"
49
  msgstr "siehe Details"
50
 
51
- #: includes/Loader.php:671
52
  msgid "This post will be shared on social media in 2-3 minutes!"
53
  msgstr "Dein Beitrag wird in ca. 2-3 Minuten in die Social Media eingestellt!"
54
 
55
- #: includes/Loader.php:675
56
  msgid "Please, make sure that your post are publish on this blog on this moment. Then you can auto post your post with Blog2social."
57
  msgstr "Bitte stelle sicher, dass Dein Beitrag in diesem Moment veröffentlicht wurde. Dann kannst Du Deinen Beitrag automatisch mit Blog2Social posten."
58
 
59
- #: includes/Loader.php:678 includes/B2S/PostBox.php:79
60
  msgid "There are no authorizations for your selected profile. Please, authorize with a social network or select a other profile."
61
  msgstr "Dein ausgewähltes Profil hat keine Autorisierungen. Bitte, verbinde Dich mit einem Netzwerk oder wähle ein anderes Profil aus. "
62
 
63
- #: includes/Loader.php:690
64
  msgid "Upgrade to Premium"
65
  msgstr "Premium freischalten"
66
 
67
- #: includes/Loader.php:720
68
  msgid "Notifications"
69
  msgstr "Benachrichtigungen"
70
 
71
- #: includes/Loader.php:720
72
  msgid "Shared Posts"
73
  msgstr "Geteilte Beiträge"
74
 
75
- #: includes/Loader.php:720
76
  msgid "Instant Sharing"
77
  msgstr "Instant Sharing"
78
 
79
- #: includes/Loader.php:720 views/b2s/widgets/posts.php:18
 
 
 
 
80
  msgid "Scheduled Posts"
81
  msgstr "geplante Beiträge"
82
 
83
- #: includes/Loader.php:720
84
  msgid "Content Curation Drafts"
85
  msgstr "Content Curation Entwürfe"
86
 
87
- #: includes/Loader.php:721 includes/B2S/Network/Item.php:148 includes/B2S/Network/Item.php:148 includes/B2S/Network/Item.php:217 includes/B2S/Network/Item.php:523 includes/B2S/Settings/Item.php:244 includes/B2S/Ship/Portale.php:38 includes/B2S/Ship/Portale.php:38
88
  msgid "Profile"
89
  msgstr "Profil"
90
 
91
- #: includes/Loader.php:721 includes/B2S/Network/Item.php:151 includes/B2S/Network/Item.php:151 includes/B2S/Network/Item.php:278 includes/B2S/Network/Item.php:525 includes/B2S/Settings/Item.php:244 includes/B2S/Ship/Portale.php:35 includes/B2S/Ship/Portale.php:35
92
  msgid "Page"
93
  msgstr "Seite"
94
 
95
- #: includes/Loader.php:721 includes/B2S/Network/Item.php:154 includes/B2S/Network/Item.php:341 includes/B2S/Network/Item.php:528 includes/B2S/Ship/Portale.php:31 includes/B2S/Ship/Portale.php:32
96
  msgid "Group"
97
  msgstr "Gruppe"
98
 
99
- #: includes/Loader.php:722
100
  msgid "Company"
101
  msgstr "Arbeitgeber"
102
 
103
- #: includes/Loader.php:722
104
  msgid "Business"
105
  msgstr "Business"
106
 
107
- #: includes/Loader.php:723
108
  msgid "Your post could not be posted."
109
  msgstr "Dein Post ist nicht vom Netzwerk veröffentlicht worden."
110
 
111
- #: includes/Loader.php:724
112
  msgid "Your authorization has expired. Please reconnect your account in the Blog2Social network settings."
113
  msgstr "Deine Authorisierung ist abgelaufen. Bitte verbinde Deinen Account in den Blog2Social Netzwerkeinstellungen erneut."
114
 
115
- #: includes/Loader.php:725
116
  msgid "The network has marked the post as spam or abusive."
117
  msgstr "Das Netzwerk hat Deinen Post als Spam oder missbräuchlich markiert."
118
 
119
- #: includes/Loader.php:726
120
  msgid "We don't have the permission to publish your post. Please check your authorization."
121
  msgstr "Wir haben nicht Deine Erlaubnis, den Post zu veröffentlichen. Bitte überprüfe deine Autorisierung."
122
 
123
- #: includes/Loader.php:727
124
  msgid "Your authorization is interrupted. Please check your authorization. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
125
  msgstr "Die Autorisierung ist unterbrochen. Bitte überprüfe deine Autorisierung. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
126
 
127
- #: includes/Loader.php:728
128
  msgid "Your daily limit has been reached."
129
  msgstr "Dein tägliches Beitragslimit wurde erreicht."
130
 
131
- #: includes/Loader.php:729
132
  msgid "Your post could not be posted, because your image is not available or the image source does not allow to publish"
133
  msgstr "Dein Beitrag konnte nicht veröffentlicht werden, weil Dein Bild nicht verfügbar ist oder die Bildquelle es nicht erlaubt, es zu veröffentlichen."
134
 
135
- #: includes/Loader.php:730
136
  msgid "The network has blocked your account. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
137
  msgstr "Das Netzwerk hat deinen Account blockiert. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
138
 
139
- #: includes/Loader.php:731
140
  msgid "The number of images is reached. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
141
  msgstr "Die erlaubte Anzahl von Bildern ist erreicht. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
142
 
143
- #: includes/Loader.php:732
144
  msgid "Your daily limit for this network has been reached. Please try again later."
145
  msgstr "Dein tägliches Beitragslimit für dieses Netzwerk wurde erreicht. Bitte versuche es später noch einmal."
146
 
147
- #: includes/Loader.php:733
148
  msgid "The network can not publish special characters such as Emoji. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
149
  msgstr "Das Netzwerk unterstüzt keine Emojis. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
150
 
151
- #: includes/Loader.php:734
152
  msgid "Your post is a duplicate."
153
  msgstr "Du kannst auf dem Netzwerke keine Duplikate veröffentlichen."
154
 
155
- #: includes/Loader.php:735
156
  msgid "The network requires a public url."
157
  msgstr "Das Netzwerk benötigt eine öffentlich zugängliche URL."
158
 
159
- #: includes/Loader.php:736
160
  msgid "Your blog post was not available for the network at the time of publication."
161
  msgstr "Dein Blogbeitrag war zum Zeitpunkt der Veröffentlichung für das Netzwerk nicht verfügbar."
162
 
163
- #: includes/Loader.php:737
164
  msgid "You have already retweeted this post."
165
  msgstr "Du hast diesen Post bereits retweetet."
166
 
167
- #: includes/Loader.php:738
168
  msgid "This XING API is no longer supported by XING. Please connect your XING accounts with the new XING interface to reschedule your posts. <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/index.php?action=artikel&cat=2&id=146\">Learn more</a>"
169
  msgstr ""
170
  "Diese XING-Schnittstelle wird nicht weiter von XING unterstützt wird. Bitte nutze ab jetzt die neue XING-Schnittstelle, um Deine XING Posts neu zu planen. <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/index.php?action=artikel&cat=2&id=145&artlang=de\">Weitere "
171
  "Informationen.</a>"
172
 
173
- #: includes/Loader.php:739
174
  msgid "There was no image in the meta data of the linked post. Posts without images cannot be shared on image networks."
175
  msgstr "Es konnte kein Bild in den Meta Daten des verlinkten Beitrags gefunden werden. Posts ohne Bilder können nicht auf Bilder-Netzwerken veröffentlicht werden. "
176
 
177
- #: includes/Loader.php:740
178
  msgid "Your post could not be posted, because your image can not be processed by the network."
179
  msgstr "Dein Beitrag konnte nicht veröffentlicht werden, da Dein Bild nicht vom Netzwerk verarbeitet werden kann."
180
 
181
- #: includes/Loader.php:741
 
 
 
 
182
  msgid "Your group can not be found by the network."
183
  msgstr "Deine Gruppe kann vom Netzwerk nicht gefunden werden."
184
 
185
- #: includes/Loader.php:797 includes/Loader.php:834
186
  msgid "Dashboard"
187
  msgstr "Dashboard"
188
 
189
- #: includes/Loader.php:798 includes/Loader.php:841
190
  msgid "Posts & Sharing"
191
  msgstr "Beiträge"
192
 
193
- #: includes/Loader.php:799 includes/Loader.php:848 views/b2s/dashboard.php:28
194
  msgid "Calendar"
195
  msgstr "Kalender"
196
 
197
- #: includes/Loader.php:800 includes/Loader.php:856
198
  msgid "Content Curation"
199
  msgstr "Content Curation"
200
 
201
- #: includes/Loader.php:801 includes/Loader.php:863
202
  msgid "Networks"
203
  msgstr "Netzwerke"
204
 
205
- #: includes/Loader.php:802 includes/Loader.php:869
206
  msgid "Settings"
207
  msgstr "Einstellungen"
208
 
209
- #: includes/Loader.php:803 includes/Loader.php:875
210
  msgid "PR-Service"
211
  msgstr "PR-Service"
212
 
213
- #: includes/Loader.php:804 includes/Loader.php:882
214
  msgid "Help & Support"
215
  msgstr "Hilfe & Support"
216
 
217
- #: includes/Loader.php:805
218
  msgid "Premium"
219
  msgstr "Premium"
220
 
221
- #: includes/Loader.php:805 includes/Loader.php:888 includes/B2S/PostBox.php:108 views/b2s/network.php:33 views/b2s/ship.php:21 includes/B2S/Curation/View.php:53 includes/B2S/Network/Item.php:148 includes/B2S/Network/Item.php:151 includes/B2S/Network/Item.php:155
222
- #: includes/B2S/Network/Item.php:158 includes/B2S/Network/Item.php:250 includes/B2S/Network/Item.php:312 includes/B2S/Network/Item.php:374 includes/B2S/Settings/Item.php:102 includes/B2S/Ship/Image.php:73 includes/B2S/Ship/Image.php:80 includes/B2S/Ship/Item.php:787
223
  #: includes/B2S/Ship/Portale.php:32 includes/B2S/Ship/Portale.php:35 includes/B2S/Ship/Portale.php:38 views/b2s/partials/post-edit-modal.php:9 views/b2s/widgets/posts.php:18
224
  msgid "PREMIUM"
225
  msgstr "PREMIUM"
226
 
227
- #: includes/Loader.php:825
228
  msgid "Blog2Social"
229
  msgstr "Blog2Social"
230
 
231
- #: includes/Loader.php:1285 includes/Loader.php:1470
232
  msgid "or"
233
  msgstr "oder"
234
 
235
- #: includes/Loader.php:1285 includes/Loader.php:1470
236
  msgid "back to install plugins"
237
  msgstr "zurück zur Pluginübersicht"
238
 
@@ -310,11 +318,12 @@ msgstr "Unbekannter Fehler"
310
  msgid "<b> An unknown error occurred! </b> <br> Please contact our support!"
311
  msgstr "<b> Ein unbekannter Fehler ist aufgetreten. </b> <br> Bitte kontaktiere unseren Support."
312
 
313
- #: includes/Ajax/Get.php:500 includes/Ajax/Post.php:1356 views/b2s/network.php:5 includes/B2S/Network/Item.php:215 includes/B2S/Network/Item.php:276 includes/B2S/Network/Item.php:339 includes/B2S/Network/Item.php:465 includes/B2S/Network/Item.php:481
314
  msgid "Unknown username"
315
  msgstr "unbekannter Blognutzer"
316
 
317
- #: includes/Ajax/Post.php:1357 includes/B2S/Network/Item.php:466 includes/B2S/Post/Item.php:606 includes/B2S/Post/Item.php:655 includes/B2S/Settings/Item.php:82 includes/B2S/Ship/Item.php:764 includes/B2S/Ship/Item.php:914
 
318
  msgid "delete"
319
  msgstr "löschen"
320
 
@@ -326,7 +335,7 @@ msgstr "Siehe FAQ"
326
  msgid "last auto-post:"
327
  msgstr "letzter Auto-Post:"
328
 
329
- #: includes/B2S/PostBox.php:76 views/b2s/ship.php:548
330
  msgid "The connection to the server failed. Try again!"
331
  msgstr "Eine Verbindung zum Server konnte nicht hergestellt werden. Versuche es erneut!"
332
 
@@ -350,7 +359,7 @@ msgstr "Hinweis: Bitte stelle sicher, dass Dein Blog von außen erreichbar ist.
350
  msgid "Custom Sharing & Scheduling"
351
  msgstr "Anpassen & Planen"
352
 
353
- #: includes/B2S/PostBox.php:97 includes/B2S/PostBox.php:101 views/b2s/ship.php:60 views/b2s/ship.php:150 views/b2s/ship.php:237 includes/B2S/Network/Item.php:170 includes/B2S/Ship/Item.php:728
354
  msgid "Info"
355
  msgstr "Info"
356
 
@@ -375,7 +384,7 @@ msgid "enable Auto-Posting"
375
  msgstr "Auto-Posting aktivieren"
376
 
377
  #: includes/B2S/PostBox.php:115 views/b2s/curation.draft.php:45 views/b2s/network.php:57 views/b2s/network.php:145 views/b2s/network.php:221 views/b2s/network.php:352 views/b2s/post.approve.php:50 views/b2s/post.calendar.php:59 views/b2s/post.calendar.php:238
378
- #: views/b2s/post.notice.php:44 views/b2s/post.php:40 views/b2s/post.publish.php:44 views/b2s/post.sched.php:58 views/b2s/ship.php:172 views/b2s/ship.php:546 views/b2s/support.php:203
379
  msgid "Loading..."
380
  msgstr "Wird geladen..."
381
 
@@ -419,61 +428,61 @@ msgstr "Wenn Du Deinen Blogbeitrag an einem bestimmten Datum und zu bestimmten Z
419
  msgid "You want to auto-post your blog post?"
420
  msgstr "Du möchtest Deinen Beitrag automatisch posten?"
421
 
422
- #: includes/B2S/PostBox.php:148 views/b2s/curation.php:126 views/b2s/post.calendar.php:276 views/b2s/ship.php:288 views/b2s/ship.php:348 views/b2s/ship.php:394
423
  msgid "With Blog2Social Premium you can:"
424
  msgstr "Mit Blog2Social kannst Du:"
425
 
426
- #: includes/B2S/PostBox.php:151 views/b2s/curation.php:129 views/b2s/post.calendar.php:279 views/b2s/ship.php:291 views/b2s/ship.php:351 views/b2s/ship.php:397
427
  msgid "Post on pages and groups"
428
  msgstr "Poste auf Seiten und in Gruppen"
429
 
430
- #: includes/B2S/PostBox.php:152 views/b2s/curation.php:130 views/b2s/post.calendar.php:280 views/b2s/ship.php:292 views/b2s/ship.php:352 views/b2s/ship.php:398
431
  msgid "Share on multiple profiles, pages and groups"
432
  msgstr "Auf mehreren Profilen, Seiten und Gruppen teilen"
433
 
434
- #: includes/B2S/PostBox.php:153 views/b2s/curation.php:131 views/b2s/post.calendar.php:281 views/b2s/ship.php:293 views/b2s/ship.php:353 views/b2s/ship.php:399
435
  msgid "Auto-post and auto-schedule new and updated blog posts"
436
  msgstr " Auto-posten und Auto-planen: Beiträge automatisch bei Veröffentlichung oder Aktualisierung posten und zeitversetzt planen"
437
 
438
- #: includes/B2S/PostBox.php:154 views/b2s/curation.php:132 views/b2s/post.calendar.php:282 views/b2s/ship.php:294 views/b2s/ship.php:354 views/b2s/ship.php:400
439
  msgid "Schedule your posts at the best times on each network"
440
  msgstr "Plane Deine Beiträge zu den besten Zeiten für jedes Netzwerk"
441
 
442
- #: includes/B2S/PostBox.php:155 views/b2s/curation.php:133 views/b2s/post.calendar.php:283 views/b2s/ship.php:295 views/b2s/ship.php:355 views/b2s/ship.php:401
443
  msgid "Best Time Manager: use predefined best time scheduler to auto-schedule your social media posts"
444
  msgstr " Beste Zeiten Manager: vordefinierte Zeiten für Deine Beiträge nutzen"
445
 
446
- #: includes/B2S/PostBox.php:156 views/b2s/curation.php:134 views/b2s/post.calendar.php:284 views/b2s/ship.php:296 views/b2s/ship.php:356 views/b2s/ship.php:402
447
  msgid "Schedule your post for one time, multiple times or recurrently"
448
  msgstr "Veröffentlichungen zur besten Zeit pro Netzwerk planen: einmalig, mehrmalig oder nach einem regelmäßigen Muster"
449
 
450
- #: includes/B2S/PostBox.php:157 views/b2s/curation.php:135 views/b2s/post.calendar.php:285 views/b2s/ship.php:297 views/b2s/ship.php:357 views/b2s/ship.php:403
451
  msgid "Schedule and re-share old posts"
452
  msgstr "Plane und teile alte Beiträge"
453
 
454
- #: includes/B2S/PostBox.php:158 views/b2s/curation.php:136 views/b2s/post.calendar.php:286 views/b2s/ship.php:298 views/b2s/ship.php:358 views/b2s/ship.php:404
455
  msgid "Select link format or image format for your posts"
456
  msgstr "Link-Posts oder Bild-Posts als Posting-Format für Deine Beiträge auswählen"
457
 
458
- #: includes/B2S/PostBox.php:159 views/b2s/curation.php:137 views/b2s/post.calendar.php:287 views/b2s/ship.php:299 views/b2s/ship.php:359 views/b2s/ship.php:405
459
  msgid "Select individual images per post"
460
  msgstr "Individuelle Bilder für Deine Social Media Posts pro Netzwerk auswählen"
461
 
462
- #: includes/B2S/PostBox.php:160 views/b2s/curation.php:138 views/b2s/post.calendar.php:288 views/b2s/ship.php:300 views/b2s/ship.php:360 views/b2s/ship.php:406
463
  msgid "Reporting & calendar: keep track of your published and scheduled social media posts"
464
  msgstr "Reporting & Kalender: Verfolge Deine veröffentlichten und geplanten Social Media Beiträge"
465
 
466
- #: includes/B2S/PostBox.php:162 views/b2s/curation.php:140 views/b2s/post.calendar.php:290 views/b2s/ship.php:302 views/b2s/ship.php:362 views/b2s/ship.php:408
467
  msgid "Upgrade to PREMIUM"
468
  msgstr "Jetzt auf Premium upgraden"
469
 
470
- #: includes/B2S/PostBox.php:164 views/b2s/curation.php:142 views/b2s/post.calendar.php:292 views/b2s/ship.php:304 views/b2s/ship.php:364 views/b2s/ship.php:410
471
  msgid "or <a href=\"http://service.blog2social.com/trial\" target=\"_blank\">start with free 30-days-trial of Blog2Social Premium</a> (no payment information needed)"
472
  msgstr "oder <a href=\"http://service.blog2social.com/trial\" target=\"_blank\">starte Deinen kostenlosen 30-tägigen Test von Blog2Social Premium</a>(keine Zahlungsinformationen erforderlich)"
473
 
474
  #: includes/B2S/PostBox.php:177 includes/B2S/Curation/View.php:70
475
- msgid "Select profile:"
476
- msgstr "Profil auswählen: "
477
 
478
  #: includes/B2S/PostBox.php:188 includes/B2S/Curation/View.php:94
479
  msgid "Select Twitter profile:"
@@ -497,7 +506,7 @@ msgstr "Zu meinen besten Zeiten planen"
497
 
498
  #: includes/B2S/PostBox.php:227
499
  msgid "You want to schedule your blog post with Auto-Poster?"
500
- msgstr "Du willst Deinen Blogbeitrag mit dem Autoposter planen?"
501
 
502
  #: includes/B2S/PostBox.php:227
503
  msgid "Upgrade to PREMIUM PRO"
@@ -507,7 +516,7 @@ msgstr "Upgrade auf PREMIUM PRO"
507
  msgid "Select date:"
508
  msgstr "Datum auswählen:"
509
 
510
- #: includes/B2S/PostBox.php:234 includes/B2S/Ship/Item.php:347
511
  msgid "show calendar"
512
  msgstr "Planungskalender anzeigen"
513
 
@@ -531,6 +540,23 @@ msgstr "Speicher beim Surfen Links aus Deinem Browser und teile sie, wann immer
531
  msgid "Get the Blog2Social Browser Extension"
532
  msgstr " Blog2Social Browser Extension installieren"
533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  #: views/b2s/curation.php:28
535
  msgid "No link preview available. Please check your link."
536
  msgstr "Keine Link-Vorschau verfügbar. Bitte überprüfe Deinen Link."
@@ -567,73 +593,69 @@ msgstr "weiter"
567
  msgid "Load data..."
568
  msgstr "Daten werden geladen..."
569
 
570
- #: views/b2s/curation.php:73 views/b2s/post.calendar.php:37 views/b2s/ship.php:16 views/b2s/ship.php:547 includes/B2S/Post/Filter.php:50 includes/B2S/Post/Item.php:248 includes/B2S/Ship/Save.php:417 includes/PRG/Post/Filter.php:41 includes/PRG/Post/Item.php:97
571
  msgid "published"
572
  msgstr "veröffentlicht"
573
 
574
- #: views/b2s/curation.php:90 views/b2s/post.approve.php:101 views/b2s/ship.php:447
575
  msgid "Do you want to mark this post as published ?"
576
  msgstr "Möchtest Du diesen Beitrag als veröffentlicht markieren?"
577
 
578
- #: views/b2s/curation.php:95 views/b2s/post.approve.php:106 views/b2s/ship.php:452
579
  msgid "YES"
580
  msgstr "JA"
581
 
582
- #: views/b2s/curation.php:96 views/b2s/network.php:105 views/b2s/post.approve.php:90 views/b2s/post.approve.php:107 views/b2s/post.notice.php:77 views/b2s/post.publish.php:77 views/b2s/post.sched.php:91 views/b2s/ship.php:453 views/prg/ship.php:92 views/b2s/widgets/posts.php:67
583
- msgid "NO"
584
- msgstr "NEIN"
585
-
586
- #: views/b2s/curation.php:109 views/b2s/post.calendar.php:259 views/b2s/ship.php:377
587
  msgid "Need to schedule your posts?"
588
  msgstr "Du möchtest Deine Beiträge planen?"
589
 
590
- #: views/b2s/curation.php:112 views/b2s/post.calendar.php:262 views/b2s/ship.php:380
591
  msgid "Blog2Social Premium covers everything you need."
592
  msgstr "Blog2Social Premium deckt alles ab, was Du brauchst."
593
 
594
- #: views/b2s/curation.php:115 views/b2s/post.calendar.php:265 views/b2s/ship.php:383 includes/B2S/Ship/Item.php:788
595
  msgid "Schedule for specific dates"
596
  msgstr "Für bestimmte Termine planen"
597
 
598
- #: views/b2s/curation.php:116 views/b2s/post.calendar.php:266 views/b2s/ship.php:384
599
  msgid "You want to publish a post on a specific date? No problem! Just enter your desired date and you are ready to go!"
600
  msgstr "Du möchtest einen Beitrag an einem ganz bestimmten Datum veröffentlichen? Kein Problem! Stelle einfach Dein Wunschdatum ein und los geht’s!"
601
 
602
- #: views/b2s/curation.php:118 views/b2s/post.calendar.php:268 views/b2s/ship.php:386
603
  msgid "Schedule post recurrently"
604
  msgstr "Beitrag mehrfach planen"
605
 
606
- #: views/b2s/curation.php:119 views/b2s/post.calendar.php:269 views/b2s/ship.php:387
607
  msgid "You have evergreen content you want to re-share from time to time in your timeline? Schedule your evergreen content to be shared once, multiple times or recurringly at specific times."
608
  msgstr "Du möchtest Deine beliebtesten Beiträge wiederholt auf den Social Media teilen? Teile Deine Evergreen Inhalte einmal, mehrmals oder in einem wiederkehrenden Rhythmus"
609
 
610
- #: views/b2s/curation.php:121 views/b2s/post.calendar.php:271 views/b2s/ship.php:389
611
  msgid "Best Time Scheduler"
612
  msgstr "Beste Zeiten Manager"
613
 
614
- #: views/b2s/curation.php:122 views/b2s/post.calendar.php:272 views/b2s/ship.php:390
615
  msgid "Whenever you publish a post, only a fraction of your followers will actually see your post. Use the Blog2Social Best Times Scheduler to share your post at the best times for each social network. Get more outreach and extend the lifespan of your posts."
616
  msgstr ""
617
  "Wenn Du einen Post in den Social Media veröffentlichst, wird Dein Beitrag immer nur von einer kleinen Anzahl Deiner Follower wahrgenommen. Nutze den Beste Zeiten Manager, um Deine Beiträge zu den besten Zeiten des jeweiligen Netzwerks zu teilen. Steigere so die Reichweite, "
618
  "Interaktion und Lebensdauer Deiner Posts."
619
 
620
- #: views/b2s/dashboard.php:15
621
  msgid "What's New"
622
  msgstr "Das ist neu"
623
 
624
- #: views/b2s/dashboard.php:24
625
  msgid "Your Activity"
626
  msgstr "Deine Aktivitäten"
627
 
628
- #: views/b2s/dashboard.php:29
629
  msgid "List"
630
  msgstr "Liste"
631
 
632
- #: views/b2s/dashboard.php:30
633
  msgid "Chart"
634
  msgstr "Diagramm"
635
 
636
- #: views/b2s/dashboard.php:57
637
  msgid "Follow us"
638
  msgstr "Folge uns"
639
 
@@ -653,11 +675,11 @@ msgstr "Du möchtest eine neue Kombination von Netzwerken anlegen?"
653
  msgid "Delete"
654
  msgstr "Löschen"
655
 
656
- #: views/b2s/network.php:44 views/b2s/ship.php:58 views/b2s/ship.php:347
657
  msgid "You want to schedule your posts and use the Best Time Scheduler?"
658
  msgstr "Du möchtest die Veröffentlichung Deiner Posts planen und den Beste Zeiten Manager benutzen?"
659
 
660
- #: views/b2s/network.php:45 views/b2s/ship.php:59
661
  msgid "Load Best Times"
662
  msgstr "Lade beste Zeiten"
663
 
@@ -673,11 +695,7 @@ msgstr "Profil löschen"
673
  msgid "Do you really want to delete this profile"
674
  msgstr "Soll Dein Profil wirklich gelöscht werden?"
675
 
676
- #: views/b2s/network.php:106 views/b2s/network.php:169 views/b2s/post.approve.php:91 views/b2s/post.notice.php:78 views/b2s/post.publish.php:78 views/b2s/post.sched.php:92 views/b2s/widgets/posts.php:68
677
- msgid "YES, delete"
678
- msgstr "Ja, löschen"
679
-
680
- #: views/b2s/network.php:117 views/b2s/premium.php:124
681
  msgid "Google My Business"
682
  msgstr "Google My Business"
683
 
@@ -691,7 +709,7 @@ msgstr ""
691
  msgid "Google currently allows access to the API for all companies with up to 9 locations in their Google My Business Listings. However, Google plans to extend the API for companies with more than 9 locations in their Google My Business listings."
692
  msgstr "Google erlaubt derzeit den Zugriff auf die API für alle Unternehmen mit bis zu 9 Standorten. Google plant, den Zugriff auf die API in Zukunft auch auf Unternehmen mit mehr als 9 verbundenen Standorten in Ihren Google My Business Brancheneinträgen zu erweitern."
693
 
694
- #: views/b2s/network.php:126 views/b2s/premium.php:35 views/b2s/ship.php:469 includes/B2S/Ship/Item.php:826 views/b2s/partials/post-edit-modal.php:48
695
  msgid "Learn more"
696
  msgstr "Mehr erfahren"
697
 
@@ -758,12 +776,10 @@ msgstr "Erweiterte Verbindungseinstellungen"
758
  #: views/b2s/network.php:228 views/b2s/network.php:310
759
  msgid "Move the connection to another network collection."
760
  msgstr ""
761
- "Verbindung in eine andere Netzwerk-Gruppierung verschieben.\n"
762
 
763
  #: views/b2s/network.php:233 views/b2s/network.php:262 views/b2s/network.php:265 views/b2s/network.php:268
764
  msgid "An error occured. Please contact our support."
765
  msgstr ""
766
- "Ein Fehler ist aufgetreten. Bitte kontaktiere unseren Support.\n"
767
 
768
  #: views/b2s/network.php:240 views/b2s/network.php:317
769
  msgid "move"
@@ -821,13 +837,13 @@ msgstr ""
821
  msgid "Upgrade to Blog2Social Business"
822
  msgstr "Upgrade auf Blog2Social Business"
823
 
824
- #: views/b2s/network.php:315 includes/B2S/Ship/Navbar.php:35
825
  msgid "My Profile"
826
  msgstr "Mein Profil"
827
 
828
- #: views/b2s/network.php:346 includes/B2S/Network/Item.php:158 includes/B2S/Network/Item.php:158
829
- msgid "Edit Post Format"
830
- msgstr "Postformat bearbeiten"
831
 
832
  #: views/b2s/network.php:358 views/b2s/settings.php:54
833
  msgid "save"
@@ -841,69 +857,64 @@ msgstr "Instant Caching für Facebook Link-Beiträge"
841
  msgid ""
842
  "Please enable this feature, if you are using varnish caching (HTTP accelerator to relieve your website). Blog2Social will add a \"no-cache=1\" parameter to the post URL of your Facebook link posts to ensure that Facebook always pulls the current meta data of your blog post."
843
  msgstr ""
844
- "Bitte aktiviere diese Funktion, wenn Du varnish caching (HTTP-Beschleuniger zur Entlastung Deiner Website) nutzt. Blog2Social hängt dann bei Deinen Facebook Link-Beiträgen den “no-cache=1” Parameter an die Beitrags-URL, um sicherzustellen, dass Facebook immer die aktuellen "
845
- "Meta Daten Deines Blogbeitrags zieht."
846
 
847
  #: views/b2s/network.php:384
848
  msgid "Choose your Post Format"
849
- msgstr "Wähle Dein Postformat"
850
 
851
  #: views/b2s/network.php:388 views/b2s/network.php:391 views/b2s/network.php:394
852
  msgid "Decide in which post format you want to post your content: Link post or image post."
853
- msgstr "Entscheide, in welchem Format Du Deine Inhalte veröffentlichen möchtest: Link-Beitrag oder Bild-Beitrag."
854
 
855
  #: views/b2s/network.php:397
856
  msgid "Decide in wich form you want to post your Content. Either as image with frame, or as image cut out."
857
- msgstr " Entscheide, in welcher Form Du Deine Inhalte veröffentlichen möchtest. Entweder als Bild mit Rahmen oder als Bildausschnitt."
858
 
859
  #: views/b2s/network.php:409
860
  msgid "Post Content"
861
- msgstr "Post-Inhalt"
862
 
863
  #: views/b2s/network.php:412
864
  msgid "Edit the content of your post. Move elements by drag and drop into the textarea and customize them as you like."
865
- msgstr "Bearbeite den Inhalt Deines Posts. Verschiebe Elemente per Drag & Drop in das Textfeld und passe sie nach Deinen Wünschen an."
866
 
867
  #: views/b2s/network.php:415
868
  msgid "Legend"
869
- msgstr "Legende"
870
 
871
  #: views/b2s/network.php:417
872
  msgid "The title of your post"
873
- msgstr "Der Titel deines Beitrags"
874
 
875
  #: views/b2s/network.php:418
876
  msgid "The summary of your post (you define it in the side menu of your post)."
877
- msgstr " Die Zusammenfassung Deines Beitrags (wird von dir im Seitenmenü deines Beitrags festgelegt)"
878
 
879
  #: views/b2s/network.php:419
880
  msgid "The content of your post"
881
- msgstr "Der Inhalt Deines Beitrags"
882
 
883
  #: views/b2s/network.php:420
884
  msgid "The tags you have set in your post."
885
- msgstr "Die Tags, die Du in deinem Beitrag gesetzt hast"
886
 
887
  #: views/b2s/network.php:433 includes/B2S/Network/Item.php:624
888
  msgid "Character limit"
889
- msgstr "Zeichenbegrenzung"
890
 
891
  #: views/b2s/network.php:436
892
  msgid "Define the character limit for the variables \"EXCERPT\" and \"CONTENT\" individually. Your text will be shortened after the last comma, period, or space character within your character limit."
893
- msgstr "Lege das Zeichenlimit für die Variablen \"Textauszug\" (EXCERPT) und \"Inhalt\" (CONTENT) einzeln fest. Dein Text wird nach dem letzten Komma, Punkt oder Leerzeichen innerhalb Deiner Zeichenbegrenzung abgeschnitten."
894
 
895
  #: views/b2s/network.php:437
896
  msgid "An \"EXCERPT\" will only be added to your social media post if you have added a manual excerpt in the excerpt editing box of the Gutenberg side menu (document settings) of your post."
897
  msgstr ""
898
- "Ein “Textauszug” wird nur in Deinen Social-Media-Beitrag eingefügt, wenn Du einen manuellen Textauszug in der Textauszug-Box im Gutenberg Seitenmenü (Dokumenten-Einstellungen) Deines Blogbeitrages eingetragen hast. \n"
899
 
900
  #: views/b2s/network.php:438
901
  msgid ""
902
  "\"TITLES\" and \"KEYWORDS\" (Hashtags) are not shortened. If you select the \"TITLE\" and \"KEYWORD\" variables for your social media posts, the character limit you define for the \"EXCERPT\" and/or \"CONTENT\" variables will be applied within the remaining available "
903
  "character limit of the social network."
904
  msgstr ""
905
- "“Titel” (TITLE) und “Hashtags” (KEYWORDS) werden nicht gekürzt. Wenn Du die Variablen “Titel” und “Hashtag” für Deine Social-Media-Posts auswählst, wird die von Dir definierte Zeichenanzahl für die Variablen \"Textauszug\" und/oder \"Inhalt\" innerhalb der darüber hinaus "
906
- "verfügbaren Zeichenanzahl des jeweiligen Social Networks berücksichtigt."
907
 
908
  #: views/b2s/post.approve.php:81
909
  msgid "Delete Social Media Posts"
@@ -925,7 +936,7 @@ msgstr "Sortiere nach Netzwerk"
925
  msgid "show all"
926
  msgstr "alles anzeigen"
927
 
928
- #: views/b2s/post.calendar.php:38 views/b2s/ship.php:16 includes/B2S/Post/Filter.php:50 includes/B2S/Post/Item.php:248 includes/PRG/Post/Filter.php:41 includes/PRG/Post/Item.php:97
929
  msgid "scheduled"
930
  msgstr "geplant"
931
 
@@ -935,41 +946,41 @@ msgstr "Link-Beitrag"
935
 
936
  #: views/b2s/post.calendar.php:69 views/b2s/post.sched.php:177 includes/B2S/Settings/Item.php:393 includes/B2S/Settings/Item.php:412
937
  msgid "Image Post"
938
- msgstr " Bild-Beitrag"
939
 
940
  #: views/b2s/post.calendar.php:86 views/b2s/post.sched.php:164
941
  msgid "add post"
942
  msgstr "Beitrag hinzufügen"
943
 
944
- #: views/b2s/post.calendar.php:105 views/b2s/post.sched.php:122 views/b2s/ship.php:482
945
  msgid "Choose your"
946
  msgstr "Wähle Deinen"
947
 
948
- #: views/b2s/post.calendar.php:105 views/b2s/post.sched.php:122 views/b2s/ship.php:482
949
  msgid "Post Format"
950
  msgstr "Postformat"
951
 
952
- #: views/b2s/post.calendar.php:107 views/b2s/post.sched.php:124 views/b2s/ship.php:484
953
  msgid "for:"
954
  msgstr "für:"
955
 
956
- #: views/b2s/post.calendar.php:126 views/b2s/post.sched.php:143 views/b2s/ship.php:502
957
  msgid "Define the default settings for the custom post format for all of your Facebook accounts in the Blog2Social settings."
958
  msgstr "Speichere Dein bevorzugtes Facebook Post-Format als Standardeinstellung in den Blog2Social Einstellungen."
959
 
960
- #: views/b2s/post.calendar.php:129 views/b2s/post.sched.php:146 views/b2s/ship.php:505
961
  msgid "Define the default settings for the custom post format for all of your Twitter accounts in the Blog2Social settings."
962
  msgstr "Definiere Dein Standard-Beitragsformat für alle Deine Twitter-Verbindungen unter den Blog2Social Einstellungen."
963
 
964
- #: views/b2s/post.calendar.php:132 views/b2s/post.sched.php:149 views/b2s/ship.php:508
965
  msgid "Define the default settings for the custom post format for all of your LinkedIn accounts in the Blog2Social settings."
966
  msgstr "Definiere die Standardeinstellung für das Postformat bei LinkedIn in den Blog2Social-Einstellungen."
967
 
968
- #: views/b2s/post.calendar.php:135 views/b2s/post.sched.php:152 views/b2s/ship.php:511
969
  msgid "Define the default settings for the custom post format for all of your Instagram accounts in the Blog2Social settings."
970
  msgstr "Definiere die Standardeinstellungen für das benutzerdefinierte Postformat für alle Instagram-Konten in den Blog2Social-Einstellungen."
971
 
972
- #: views/b2s/post.calendar.php:150 views/b2s/post.sched.php:103 views/b2s/ship.php:423
973
  msgid "Select image for"
974
  msgstr "Wähle Bild aus für"
975
 
@@ -993,6 +1004,14 @@ msgstr "Teile Beiträge aus beliebigen Quellen"
993
  msgid "Select a post"
994
  msgstr "Wähle einen Beitrag aus"
995
 
 
 
 
 
 
 
 
 
996
  #: views/b2s/post.notice.php:68 views/b2s/post.publish.php:68 views/b2s/widgets/posts.php:58
997
  msgid "Delete entries from the reporting"
998
  msgstr "Einträge aus dem Reporting löschen"
@@ -1013,145 +1032,145 @@ msgstr "Einträge aus der Planung löschen"
1013
  msgid "You are sure, you want to delete entries from the scheduling?"
1014
  msgstr "Bist Du sicher, dass Du Einträge aus Deiner Planung löschen möchtest?"
1015
 
1016
- #: views/b2s/premium.php:13 includes/B2S/Settings/Item.php:156
1017
  msgid "Your current license:"
1018
  msgstr "Deine aktuelle Lizenz:"
1019
 
1020
- #: views/b2s/premium.php:25
1021
  msgid "Try Blog2Social Premium 30 days for free"
1022
  msgstr "Teste Blog2Social Premium 30 Tage lang kostenlos."
1023
 
1024
- #: views/b2s/premium.php:29
1025
  msgid "End of Trial"
1026
  msgstr "Ende der Testzeit"
1027
 
1028
- #: views/b2s/premium.php:30 includes/B2S/Settings/Item.php:159 includes/B2S/Settings/Item.php:162
1029
  msgid "Upgrade"
1030
  msgstr "Upgrade"
1031
 
1032
- #: views/b2s/premium.php:34
1033
  msgid "Upgrade to Blog2Social Premium and get even smarter with social media automation: Schedule your posts for the best time or recurringly with the Best Time Manager or the Social Media Calendar. Post to pages, groups and multiple accounts per network."
1034
  msgstr ""
1035
  "Nutze Blog2Social Premium für noch intelligentere Social Media Automatisierung: Plane Deine Beiträge voll-automatisiert mit dem Beste-Zeiten-Manager, wähle bestimmte Termine oder plane Deine Beiträge regelmäßig. Behalte den Überblick über Deine Posts mit dem Social Media "
1036
  "Kalender. Veröffentliche Beiträge auf Seiten, in Gruppen und auf mehreren Konten pro Netzwerk. Arbeite mit mehr Nutzern im Team. "
1037
 
1038
- #: views/b2s/premium.php:40
1039
  msgid "Select a user"
1040
  msgstr " Blog-Benutzer auswählen"
1041
 
1042
- #: views/b2s/premium.php:44
1043
  msgid "No User found"
1044
  msgstr "Kein Blog-Benutzer gefunden"
1045
 
1046
- #: views/b2s/premium.php:47
1047
  msgid "Enter license key and change your version"
1048
  msgstr "Lizenzschlüssel eingeben und Version ändern"
1049
 
1050
- #: views/b2s/premium.php:49
1051
  msgid "Activate License"
1052
- msgstr "Lizenz aktivieren"
1053
 
1054
- #: views/b2s/premium.php:58
1055
  msgid "Go Premium and get even smarter with social media automation"
1056
  msgstr "Nutze Blog2Social Premium für noch intelligentere Social Media Automatisierung"
1057
 
1058
- #: views/b2s/premium.php:67
1059
  msgid "Pages and groups"
1060
  msgstr "Seiten und Gruppen"
1061
 
1062
- #: views/b2s/premium.php:68
1063
  msgid "Share your posts on pages and in groups on Facebook, LinkedIn, XING, VK and Medium."
1064
  msgstr "Teilen Sie Ihre Beiträge auf Seiten und in Gruppen auf Facebook, LinkedIn, Xing, VK und Medium."
1065
 
1066
- #: views/b2s/premium.php:76
1067
  msgid "More users and accounts"
1068
  msgstr "Mehr Benutzer und Accounts"
1069
 
1070
- #: views/b2s/premium.php:77
1071
  msgid "Add multiple users and accounts per network. Define sharing-profiles for selected network bundles."
1072
  msgstr "Füge mehrere Benutzer und Accounts pro Netzwerk hinzu. Definiere Sharing-Profile für ausgewählte Netzwerk-Bundles."
1073
 
1074
- #: views/b2s/premium.php:85
1075
  msgid "Social Media Calendar"
1076
  msgstr "Social Media Kalender"
1077
 
1078
- #: views/b2s/premium.php:86
1079
  msgid "See your entire schedule at a glance, with team view and network filter. Edit scheduled posts or add new social media posts per drag & drop."
1080
  msgstr "Sieh Deinen gesamten Zeitplan auf einen Blick, mit Teamansicht und Netzwerkfilter. Bearbeite geplante Beiträge oder füge neue Social-Media-Beiträge per Drag & Drop hinzu."
1081
 
1082
- #: views/b2s/premium.php:94
1083
  msgid "Best Times Manager"
1084
  msgstr "Beste Zeiten Manager"
1085
 
1086
- #: views/b2s/premium.php:95
1087
  msgid "Use the Best Times Manager to schedule your posts automatically or define your own best time scheme."
1088
  msgstr "Verwende den Beste-Zeiten-Manager, um Deine Beiträge automatisch zu planen oder Dein eigenes bestes Zeitschema zu definieren."
1089
 
1090
- #: views/b2s/premium.php:106 views/b2s/settings.php:34 includes/B2S/Post/Item.php:488
1091
  msgid "Auto-Posting"
1092
  msgstr "Auto-Posting"
1093
 
1094
- #: views/b2s/premium.php:107
1095
  msgid "Share your posts automatically across your preferred networks at once or at your pre-scheduled time-settings."
1096
  msgstr "Teile Deine Beiträge automatisch in Deinen bevorzugten Netzwerken sofort oder zu den von Dir festgelegten Zeiten."
1097
 
1098
- #: views/b2s/premium.php:115
1099
  msgid "RSS import & auto-post"
1100
  msgstr "RSS-Import & Auto-Poster"
1101
 
1102
- #: views/b2s/premium.php:116
1103
  msgid "Share imported RSS feeds automatically to get more variations for your content."
1104
  msgstr "Teile importierte RSS-Feeds automatisch, um mehr Variationen für Deine Inhalte zu erhalten."
1105
 
1106
- #: views/b2s/premium.php:125
1107
  msgid "Schedule and share your blog posts as Google My Business posts to update your business listing and to add fresh content for your company."
1108
  msgstr "Plane und teile Deine Blogartikel als Google My Business - Beiträge und verleihe Deinem Unternehmen mit aktuellen News mehr Sichtbarkeit."
1109
 
1110
- #: views/b2s/premium.php:133
1111
  msgid "Schedule curated content"
1112
  msgstr "Kuratierte Inhalte planen"
1113
 
1114
- #: views/b2s/premium.php:134
1115
  msgid "Schedule and share curated content from any source on your preferred networks."
1116
  msgstr "Plane und teile kuratierte Inhalte aus beliebigen Quellen in Deinen bevorzugten Netzwerken."
1117
 
1118
- #: views/b2s/premium.php:145
1119
  msgid "Custom image"
1120
  msgstr "Benutzerdefinierte Bilder"
1121
 
1122
- #: views/b2s/premium.php:146
1123
  msgid "Select individual images per post or network and select any image from your media library to create more variations for your posts."
1124
  msgstr "Wähle individuelle Bilder pro Beitrag oder Netzwerk sowie ein beliebiges Bild aus Deiner Mediathek aus, um weitere Variationen für Deine Beiträge zu erstellen."
1125
 
1126
- #: views/b2s/premium.php:154
1127
  msgid "Custom format"
1128
  msgstr "Benutzerdefiniertes Format"
1129
 
1130
- #: views/b2s/premium.php:155
1131
  msgid "Select link post or image post per network to choose the optimal format for your post."
1132
  msgstr "Wähle zwischen Link- oder Bild-Post pro Netzwerk, um das optimale Format für Deinen Beitrag zu wählen"
1133
 
1134
- #: views/b2s/premium.php:163
1135
  msgid "Open Graph and Twitter Card Tags"
1136
  msgstr "Open Graph und Twitter Card Tags"
1137
 
1138
- #: views/b2s/premium.php:164
1139
  msgid "Add and edit meta tags for Open Graph (Ex. Facebook and LinkedIn) and Twitter Cards to define the look of your link posts."
1140
  msgstr "Setze und bearbeite Social-Media-Tags für Open Graph (z.B. Facebook und LinkedIn) und Twitter Cards, um das Aussehen Deiner Link-Posts festzulegen."
1141
 
1142
- #: views/b2s/premium.php:172
1143
  msgid "Premium support"
1144
  msgstr "Premium Support"
1145
 
1146
- #: views/b2s/premium.php:173
1147
  msgid "Regular updates and priority support per e-mail and phone."
1148
  msgstr "Regelmäßige Updates und bevorzugter Support per E-Mail und Telefon"
1149
 
1150
- #: views/b2s/premium.php:178
1151
  msgid "Show me plans and prices"
1152
  msgstr "Versionen und Preise anzeigen"
1153
 
1154
- #: views/b2s/premium.php:179
1155
  msgid "Show all premium features"
1156
  msgstr "Alle Premium-Features anzeigen"
1157
 
@@ -1228,107 +1247,111 @@ msgstr ""
1228
  "Die Zeiteinstellungen zum Planen von Social Media Posts in Blog2Social basieren auf der Zeitzone, die in den allgemeinen Einstellungen Deines WordPress festgelegt ist. Du kannst aber auch eine andere Zeitzone als Basis für die Planung Deiner Social Media Posts festlegen. "
1229
  "Wähle dazu die gewünschte Zeitzone aus dem Drop-Down Menü."
1230
 
1231
- #: views/b2s/ship.php:16 includes/B2S/Post/Filter.php:50 includes/B2S/Post/Item.php:248 includes/PRG/Post/Item.php:97
1232
  msgid "draft"
1233
  msgstr "Entwurf"
1234
 
1235
- #: views/b2s/ship.php:36
1236
  msgid "Social Media Scheduling & Sharing"
1237
  msgstr "Beitrag auf Social Media planen und teilen"
1238
 
1239
- #: views/b2s/ship.php:37 views/prg/ship.php:41 views/prg/ship.php:43 includes/B2S/Curation/View.php:35 includes/B2S/Settings/Item.php:317 includes/B2S/Settings/Item.php:338
1240
  msgid "Title"
1241
  msgstr "Titel"
1242
 
1243
- #: views/b2s/ship.php:39 includes/B2S/Post/Item.php:288
1244
  msgid "on blog"
1245
  msgstr "auf dem Blog"
1246
 
1247
- #: views/b2s/ship.php:47
1248
  msgid "scroll to bottom"
1249
  msgstr "zum Seitenende"
1250
 
1251
- #: views/b2s/ship.php:52
1252
  msgid "You want to load your time settings?"
1253
  msgstr "Du möchtest Deine Zeiten laden?"
1254
 
1255
- #: views/b2s/ship.php:53
1256
  msgid "Load My Times Settings"
1257
  msgstr "Meine Zeit-Einstellungen laden"
1258
 
1259
- #: views/b2s/ship.php:89
1260
  msgid "Social Accounts"
1261
  msgstr "Social Media Konten"
1262
 
1263
- #: views/b2s/ship.php:107
1264
  msgid "Add more..."
1265
  msgstr "mehr hinzufügen"
1266
 
1267
- #: views/b2s/ship.php:109
1268
  msgid "Profiles | Pages | Groups"
1269
  msgstr "Profile | Seiten | Gruppen"
1270
 
1271
- #: views/b2s/ship.php:148
1272
  msgid "Save network collection"
1273
- msgstr "Netzwerk-Gruppierung speichern"
1274
 
1275
- #: views/b2s/ship.php:157
1276
  msgid "network connected"
1277
  msgstr "Netzwerk verbunden"
1278
 
1279
- #: views/b2s/ship.php:158
1280
  msgid "requires image"
1281
  msgstr "Bild benötigt"
1282
 
1283
- #: views/b2s/ship.php:159
1284
  msgid "refresh authorization"
1285
  msgstr "Autorisierung aktualisieren"
1286
 
1287
- #: views/b2s/ship.php:182
1288
  msgid "Notice:<br><p>Please make sure, that your website address is reachable. The Social Networks do not allow postings from local installations.</p>"
1289
  msgstr "Hinweis:<br><p>Bitte stelle sicher, dass Deine Webseiten-Adresse von außen erreichbar ist. Die sozialen Netzwerke erlauben keine Posts von lokalen Installationen.</p>"
1290
 
1291
- #: views/b2s/ship.php:184
1292
  msgid "change website address"
1293
  msgstr "Webseiten-Adresse ändern"
1294
 
1295
- #: views/b2s/ship.php:201
1296
  msgid "First, connect or select network before posting"
1297
  msgstr "Verbinde Dich zuerst mit einem Netzwerk oder wähle ein Netzwerk aus, bevor Du den Beitrag teilst!"
1298
 
1299
- #: views/b2s/ship.php:203 includes/B2S/Settings/Item.php:81
1300
  msgid "connect"
1301
  msgstr "Jetzt mit Netzwerken verbinden"
1302
 
1303
- #: views/b2s/ship.php:211
1304
  msgid "scroll to top"
1305
  msgstr "zum Seitenanfang"
1306
 
1307
- #: views/b2s/ship.php:212 views/b2s/ship.php:216 includes/B2S/Curation/View.php:111
1308
  msgid "Share"
1309
  msgstr "Teilen"
1310
 
1311
- #: views/b2s/ship.php:225
 
 
 
 
1312
  msgid "Time zone"
1313
  msgstr "Zeitzone"
1314
 
1315
- #: views/b2s/ship.php:239 views/b2s/ship.php:241 includes/B2S/Post/Item.php:305
1316
  msgid "Re-share this post"
1317
  msgstr "Diesen Beitrag nochmal teilen"
1318
 
1319
- #: views/b2s/ship.php:243
1320
  msgid "Share new post on Social Media"
1321
  msgstr "Teile einen neuen Beitrag auf Social Media"
1322
 
1323
- #: views/b2s/ship.php:265
1324
  msgid "Connect for"
1325
  msgstr "Netzwerke verbinden für"
1326
 
1327
- #: views/b2s/ship.php:281
1328
  msgid "Re-share this Post"
1329
  msgstr "Diesen Beitrag nochmal teilen"
1330
 
1331
- #: views/b2s/ship.php:284
1332
  msgid ""
1333
  "You can re-share your post for a different sharing purpose, or to share on a different choice of networks, profiles, pages or groups, or with different comments or images, or if you want to share your blog post images to image networks only, or re-share them at different "
1334
  "times. You may vary your comments and images in order to produce more variations of your social media posts to share more often without sharing the same message over and over again. Whatever your choose to do for re-sharing your post, you can simply click \"Re-share this "
@@ -1338,15 +1361,15 @@ msgstr ""
1338
  "oder um weitere Bilder zum Blogbeitrag nur an die Bilder-Netzwerke zu senden, oder um Deine Social Media Posts zu anderen Zeiten zu teilen. So erzielt Du mehr Variationen Deiner Social Media Posts und kannst Deinen Beitrag öfters posten, um mehr Aufmerksamkeit und Reichweite "
1339
  "zu erzielen, ohne immer wieder die gleiche Mitteilung zu posten. Was auch immer Du zu teilen wünscht, klicke einfach auf \"Diesen Beitrag erneut teilen\" und Du wirst erneut zur Vorschau geführt, wo Deine Netzwerke, Texte und Bilder auswählen oder variieren kannst. "
1340
 
1341
- #: views/b2s/ship.php:287
1342
  msgid "You want re-share your blog post?"
1343
  msgstr "Du möchtest Deinen Beitrag erneut teilen?"
1344
 
1345
- #: views/b2s/ship.php:315
1346
  msgid "Save Network Settings"
1347
  msgstr "Netzwerkeinstellungen speichern"
1348
 
1349
- #: views/b2s/ship.php:318
1350
  msgid ""
1351
  "You can save your current network settings as \"Standard\" network settings for any future sharing activities or as a \"Profile\" to choose from (Premium).<br><br>Your Standard selection will show as activated upon pressing the \"share on social media\" button on the right "
1352
  "hand side bar. You can change these settings any time per click, or choose another network profile (Premium).<br><br>You can also pre-define various different sets of networks, for specific social media accounts, target groups, contents or sharing purposes. For example you "
@@ -1359,35 +1382,43 @@ msgstr ""
1359
  "posten, um mehr Aufmerksamkeit und Reichweite zu erzielen, ohne immer wieder die gleiche Mitteilung zu posten. Was auch immer Du zu teilen wünscht
2
  # This file is distributed under the same license as the Plugins - Blog2Social: Social Media Auto Post &amp; Scheduler - Stable (latest release) package.
3
  msgid ""
4
  msgstr ""
5
+ "PO-Revision-Date: 2019-08-27 14:11+0000\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
11
  "Language: de_DE\n"
12
  "Project-Id-Version: Plugins - Blog2Social: Social Media Auto Post &amp; Scheduler - Stable (latest release)\n"
13
  "Report-Msgid-Bugs-To: \n"
14
+ "POT-Creation-Date: 2019-08-27 14:08+0000\n"
15
  "Last-Translator: admin <s.buerger@adenion.de>\n"
16
  "Language-Team: German\n"
17
+ "X-Loco-Version: 2.2.2; wp-5.2.3-RC1-45880"
18
 
19
  #: includes/Loader.php:44
20
  msgid "Modify pin board"
32
  msgid "Modify forum"
33
  msgstr "Modify forum"
34
 
35
+ #: includes/Loader.php:365
36
  msgid "Auto-Post on Social Media"
37
  msgstr "Automatisch auf Social Media teilen"
38
 
39
+ #: includes/Loader.php:366
40
  msgid "Social Media Content Calendar"
41
  msgstr "Social Media Kalender"
42
 
43
+ #: includes/Loader.php:670
44
  msgid "This post will be shared into your social media from"
45
  msgstr "Dein Beitrag ist zur Veröffentlichung in den Social Media geplant ab dem"
46
 
47
+ #: includes/Loader.php:670 includes/Loader.php:672
48
  msgid "show details"
49
  msgstr "siehe Details"
50
 
51
+ #: includes/Loader.php:672
52
  msgid "This post will be shared on social media in 2-3 minutes!"
53
  msgstr "Dein Beitrag wird in ca. 2-3 Minuten in die Social Media eingestellt!"
54
 
55
+ #: includes/Loader.php:676
56
  msgid "Please, make sure that your post are publish on this blog on this moment. Then you can auto post your post with Blog2social."
57
  msgstr "Bitte stelle sicher, dass Dein Beitrag in diesem Moment veröffentlicht wurde. Dann kannst Du Deinen Beitrag automatisch mit Blog2Social posten."
58
 
59
+ #: includes/Loader.php:679 includes/B2S/PostBox.php:79
60
  msgid "There are no authorizations for your selected profile. Please, authorize with a social network or select a other profile."
61
  msgstr "Dein ausgewähltes Profil hat keine Autorisierungen. Bitte, verbinde Dich mit einem Netzwerk oder wähle ein anderes Profil aus. "
62
 
63
+ #: includes/Loader.php:691
64
  msgid "Upgrade to Premium"
65
  msgstr "Premium freischalten"
66
 
67
+ #: includes/Loader.php:721
68
  msgid "Notifications"
69
  msgstr "Benachrichtigungen"
70
 
71
+ #: includes/Loader.php:721
72
  msgid "Shared Posts"
73
  msgstr "Geteilte Beiträge"
74
 
75
+ #: includes/Loader.php:721
76
  msgid "Instant Sharing"
77
  msgstr "Instant Sharing"
78
 
79
+ #: includes/Loader.php:721
80
+ msgid "Drafts"
81
+ msgstr "Entwürfe"
82
+
83
+ #: includes/Loader.php:721 views/b2s/widgets/posts.php:18
84
  msgid "Scheduled Posts"
85
  msgstr "geplante Beiträge"
86
 
87
+ #: includes/Loader.php:721
88
  msgid "Content Curation Drafts"
89
  msgstr "Content Curation Entwürfe"
90
 
91
+ #: includes/Loader.php:722 includes/B2S/Network/Item.php:148 includes/B2S/Network/Item.php:148 includes/B2S/Network/Item.php:217 includes/B2S/Network/Item.php:523 includes/B2S/Settings/Item.php:244 includes/B2S/Ship/Portale.php:38 includes/B2S/Ship/Portale.php:38
92
  msgid "Profile"
93
  msgstr "Profil"
94
 
95
+ #: includes/Loader.php:722 includes/B2S/Network/Item.php:151 includes/B2S/Network/Item.php:151 includes/B2S/Network/Item.php:278 includes/B2S/Network/Item.php:525 includes/B2S/Settings/Item.php:244 includes/B2S/Ship/Portale.php:35 includes/B2S/Ship/Portale.php:35
96
  msgid "Page"
97
  msgstr "Seite"
98
 
99
+ #: includes/Loader.php:722 includes/B2S/Network/Item.php:154 includes/B2S/Network/Item.php:341 includes/B2S/Network/Item.php:528 includes/B2S/Ship/Portale.php:31 includes/B2S/Ship/Portale.php:32
100
  msgid "Group"
101
  msgstr "Gruppe"
102
 
103
+ #: includes/Loader.php:723
104
  msgid "Company"
105
  msgstr "Arbeitgeber"
106
 
107
+ #: includes/Loader.php:723
108
  msgid "Business"
109
  msgstr "Business"
110
 
111
+ #: includes/Loader.php:724
112
  msgid "Your post could not be posted."
113
  msgstr "Dein Post ist nicht vom Netzwerk veröffentlicht worden."
114
 
115
+ #: includes/Loader.php:725
116
  msgid "Your authorization has expired. Please reconnect your account in the Blog2Social network settings."
117
  msgstr "Deine Authorisierung ist abgelaufen. Bitte verbinde Deinen Account in den Blog2Social Netzwerkeinstellungen erneut."
118
 
119
+ #: includes/Loader.php:726
120
  msgid "The network has marked the post as spam or abusive."
121
  msgstr "Das Netzwerk hat Deinen Post als Spam oder missbräuchlich markiert."
122
 
123
+ #: includes/Loader.php:727
124
  msgid "We don't have the permission to publish your post. Please check your authorization."
125
  msgstr "Wir haben nicht Deine Erlaubnis, den Post zu veröffentlichen. Bitte überprüfe deine Autorisierung."
126
 
127
+ #: includes/Loader.php:728
128
  msgid "Your authorization is interrupted. Please check your authorization. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
129
  msgstr "Die Autorisierung ist unterbrochen. Bitte überprüfe deine Autorisierung. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
130
 
131
+ #: includes/Loader.php:729
132
  msgid "Your daily limit has been reached."
133
  msgstr "Dein tägliches Beitragslimit wurde erreicht."
134
 
135
+ #: includes/Loader.php:730
136
  msgid "Your post could not be posted, because your image is not available or the image source does not allow to publish"
137
  msgstr "Dein Beitrag konnte nicht veröffentlicht werden, weil Dein Bild nicht verfügbar ist oder die Bildquelle es nicht erlaubt, es zu veröffentlichen."
138
 
139
+ #: includes/Loader.php:731
140
  msgid "The network has blocked your account. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
141
  msgstr "Das Netzwerk hat deinen Account blockiert. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
142
 
143
+ #: includes/Loader.php:732
144
  msgid "The number of images is reached. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
145
  msgstr "Die erlaubte Anzahl von Bildern ist erreicht. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
146
 
147
+ #: includes/Loader.php:733
148
  msgid "Your daily limit for this network has been reached. Please try again later."
149
  msgstr "Dein tägliches Beitragslimit für dieses Netzwerk wurde erreicht. Bitte versuche es später noch einmal."
150
 
151
+ #: includes/Loader.php:734
152
  msgid "The network can not publish special characters such as Emoji. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/category/9/troubleshooting-for-error-messages.html\">FAQ</a>."
153
  msgstr "Das Netzwerk unterstüzt keine Emojis. Siehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/category/9/fehlermeldungen-und-loesungen.html\">FAQ</a>."
154
 
155
+ #: includes/Loader.php:735
156
  msgid "Your post is a duplicate."
157
  msgstr "Du kannst auf dem Netzwerke keine Duplikate veröffentlichen."
158
 
159
+ #: includes/Loader.php:736
160
  msgid "The network requires a public url."
161
  msgstr "Das Netzwerk benötigt eine öffentlich zugängliche URL."
162
 
163
+ #: includes/Loader.php:737
164
  msgid "Your blog post was not available for the network at the time of publication."
165
  msgstr "Dein Blogbeitrag war zum Zeitpunkt der Veröffentlichung für das Netzwerk nicht verfügbar."
166
 
167
+ #: includes/Loader.php:738
168
  msgid "You have already retweeted this post."
169
  msgstr "Du hast diesen Post bereits retweetet."
170
 
171
+ #: includes/Loader.php:739
172
  msgid "This XING API is no longer supported by XING. Please connect your XING accounts with the new XING interface to reschedule your posts. <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/index.php?action=artikel&cat=2&id=146\">Learn more</a>"
173
  msgstr ""
174
  "Diese XING-Schnittstelle wird nicht weiter von XING unterstützt wird. Bitte nutze ab jetzt die neue XING-Schnittstelle, um Deine XING Posts neu zu planen. <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/index.php?action=artikel&cat=2&id=145&artlang=de\">Weitere "
175
  "Informationen.</a>"
176
 
177
+ #: includes/Loader.php:740
178
  msgid "There was no image in the meta data of the linked post. Posts without images cannot be shared on image networks."
179
  msgstr "Es konnte kein Bild in den Meta Daten des verlinkten Beitrags gefunden werden. Posts ohne Bilder können nicht auf Bilder-Netzwerken veröffentlicht werden. "
180
 
181
+ #: includes/Loader.php:741
182
  msgid "Your post could not be posted, because your image can not be processed by the network."
183
  msgstr "Dein Beitrag konnte nicht veröffentlicht werden, da Dein Bild nicht vom Netzwerk verarbeitet werden kann."
184
 
185
+ #: includes/Loader.php:742
186
+ msgid "Instagram published your post without text. Please see <a target=\"_blank\" href=\"https://www.blog2social.com/en/faq/index.php?action=artikel&cat=9&id=154&artlang=en\">FAQ</a>."
187
+ msgstr "Instagram konnte Deinen Text nicht veröffentlichen. Sehe <a target=\"_blank\" href=\"https://www.blog2social.com/de/faq/index.php?sid=417653&lang=de&action=artikel&cat=9&id=152&artlang=de\">FAQ</a>."
188
+
189
+ #: includes/Loader.php:743
190
  msgid "Your group can not be found by the network."
191
  msgstr "Deine Gruppe kann vom Netzwerk nicht gefunden werden."
192
 
193
+ #: includes/Loader.php:799 includes/Loader.php:841
194
  msgid "Dashboard"
195
  msgstr "Dashboard"
196
 
197
+ #: includes/Loader.php:800 includes/Loader.php:848
198
  msgid "Posts & Sharing"
199
  msgstr "Beiträge"
200
 
201
+ #: includes/Loader.php:801 includes/Loader.php:855 views/b2s/dashboard.php:30
202
  msgid "Calendar"
203
  msgstr "Kalender"
204
 
205
+ #: includes/Loader.php:802 includes/Loader.php:863
206
  msgid "Content Curation"
207
  msgstr "Content Curation"
208
 
209
+ #: includes/Loader.php:803 includes/Loader.php:870
210
  msgid "Networks"
211
  msgstr "Netzwerke"
212
 
213
+ #: includes/Loader.php:804 includes/Loader.php:876
214
  msgid "Settings"
215
  msgstr "Einstellungen"
216
 
217
+ #: includes/Loader.php:806 includes/Loader.php:884
218
  msgid "PR-Service"
219
  msgstr "PR-Service"
220
 
221
+ #: includes/Loader.php:808 includes/Loader.php:892
222
  msgid "Help & Support"
223
  msgstr "Hilfe & Support"
224
 
225
+ #: includes/Loader.php:810
226
  msgid "Premium"
227
  msgstr "Premium"
228
 
229
+ #: includes/Loader.php:810 includes/Loader.php:900 includes/B2S/PostBox.php:108 views/b2s/network.php:33 views/b2s/ship.php:21 includes/B2S/Curation/View.php:53 includes/B2S/Network/Item.php:148 includes/B2S/Network/Item.php:151 includes/B2S/Network/Item.php:155
230
+ #: includes/B2S/Network/Item.php:158 includes/B2S/Network/Item.php:250 includes/B2S/Network/Item.php:312 includes/B2S/Network/Item.php:374 includes/B2S/Settings/Item.php:102 includes/B2S/Ship/Image.php:73 includes/B2S/Ship/Image.php:80 includes/B2S/Ship/Item.php:805
231
  #: includes/B2S/Ship/Portale.php:32 includes/B2S/Ship/Portale.php:35 includes/B2S/Ship/Portale.php:38 views/b2s/partials/post-edit-modal.php:9 views/b2s/widgets/posts.php:18
232
  msgid "PREMIUM"
233
  msgstr "PREMIUM"
234
 
235
+ #: includes/Loader.php:832
236
  msgid "Blog2Social"
237
  msgstr "Blog2Social"
238
 
239
+ #: includes/Loader.php:1310 includes/Loader.php:1508
240
  msgid "or"
241
  msgstr "oder"
242
 
243
+ #: includes/Loader.php:1310 includes/Loader.php:1508
244
  msgid "back to install plugins"
245
  msgstr "zurück zur Pluginübersicht"
246
 
318
  msgid "<b> An unknown error occurred! </b> <br> Please contact our support!"
319
  msgstr "<b> Ein unbekannter Fehler ist aufgetreten. </b> <br> Bitte kontaktiere unseren Support."
320
 
321
+ #: includes/Ajax/Get.php:524 includes/Ajax/Post.php:1376 views/b2s/network.php:5 includes/B2S/Network/Item.php:215 includes/B2S/Network/Item.php:276 includes/B2S/Network/Item.php:339 includes/B2S/Network/Item.php:465 includes/B2S/Network/Item.php:481
322
  msgid "Unknown username"
323
  msgstr "unbekannter Blognutzer"
324
 
325
+ #: includes/Ajax/Post.php:1377 includes/B2S/Network/Item.php:466 includes/B2S/Post/Item.php:408 includes/B2S/Post/Item.php:428 includes/B2S/Post/Item.php:657 includes/B2S/Post/Item.php:706 includes/B2S/Settings/Item.php:82 includes/B2S/Ship/Item.php:782
326
+ #: includes/B2S/Ship/Item.php:932
327
  msgid "delete"
328
  msgstr "löschen"
329
 
335
  msgid "last auto-post:"
336
  msgstr "letzter Auto-Post:"
337
 
338
+ #: includes/B2S/PostBox.php:76 views/b2s/ship.php:581
339
  msgid "The connection to the server failed. Try again!"
340
  msgstr "Eine Verbindung zum Server konnte nicht hergestellt werden. Versuche es erneut!"
341
 
359
  msgid "Custom Sharing & Scheduling"
360
  msgstr "Anpassen & Planen"
361
 
362
+ #: includes/B2S/PostBox.php:97 includes/B2S/PostBox.php:101 views/b2s/ship.php:74 views/b2s/ship.php:164 views/b2s/ship.php:253 includes/B2S/Network/Item.php:170 includes/B2S/Ship/Item.php:746
363
  msgid "Info"
364
  msgstr "Info"
365
 
384
  msgstr "Auto-Posting aktivieren"
385
 
386
  #: includes/B2S/PostBox.php:115 views/b2s/curation.draft.php:45 views/b2s/network.php:57 views/b2s/network.php:145 views/b2s/network.php:221 views/b2s/network.php:352 views/b2s/post.approve.php:50 views/b2s/post.calendar.php:59 views/b2s/post.calendar.php:238
387
+ #: views/b2s/post.draft.php:42 views/b2s/post.notice.php:44 views/b2s/post.php:40 views/b2s/post.publish.php:44 views/b2s/post.sched.php:58 views/b2s/ship.php:186 views/b2s/ship.php:579 views/b2s/support.php:203
388
  msgid "Loading..."
389
  msgstr "Wird geladen..."
390
 
428
  msgid "You want to auto-post your blog post?"
429
  msgstr "Du möchtest Deinen Beitrag automatisch posten?"
430
 
431
+ #: includes/B2S/PostBox.php:148 views/b2s/curation.php:126 views/b2s/post.calendar.php:276 views/b2s/ship.php:304 views/b2s/ship.php:364 views/b2s/ship.php:410
432
  msgid "With Blog2Social Premium you can:"
433
  msgstr "Mit Blog2Social kannst Du:"
434
 
435
+ #: includes/B2S/PostBox.php:151 views/b2s/curation.php:129 views/b2s/post.calendar.php:279 views/b2s/ship.php:307 views/b2s/ship.php:367 views/b2s/ship.php:413
436
  msgid "Post on pages and groups"
437
  msgstr "Poste auf Seiten und in Gruppen"
438
 
439
+ #: includes/B2S/PostBox.php:152 views/b2s/curation.php:130 views/b2s/post.calendar.php:280 views/b2s/ship.php:308 views/b2s/ship.php:368 views/b2s/ship.php:414
440
  msgid "Share on multiple profiles, pages and groups"
441
  msgstr "Auf mehreren Profilen, Seiten und Gruppen teilen"
442
 
443
+ #: includes/B2S/PostBox.php:153 views/b2s/curation.php:131 views/b2s/post.calendar.php:281 views/b2s/ship.php:309 views/b2s/ship.php:369 views/b2s/ship.php:415
444
  msgid "Auto-post and auto-schedule new and updated blog posts"
445
  msgstr " Auto-posten und Auto-planen: Beiträge automatisch bei Veröffentlichung oder Aktualisierung posten und zeitversetzt planen"
446
 
447
+ #: includes/B2S/PostBox.php:154 views/b2s/curation.php:132 views/b2s/post.calendar.php:282 views/b2s/ship.php:310 views/b2s/ship.php:370 views/b2s/ship.php:416
448
  msgid "Schedule your posts at the best times on each network"
449
  msgstr "Plane Deine Beiträge zu den besten Zeiten für jedes Netzwerk"
450
 
451
+ #: includes/B2S/PostBox.php:155 views/b2s/curation.php:133 views/b2s/post.calendar.php:283 views/b2s/ship.php:311 views/b2s/ship.php:371 views/b2s/ship.php:417
452
  msgid "Best Time Manager: use predefined best time scheduler to auto-schedule your social media posts"
453
  msgstr " Beste Zeiten Manager: vordefinierte Zeiten für Deine Beiträge nutzen"
454
 
455
+ #: includes/B2S/PostBox.php:156 views/b2s/curation.php:134 views/b2s/post.calendar.php:284 views/b2s/ship.php:312 views/b2s/ship.php:372 views/b2s/ship.php:418
456
  msgid "Schedule your post for one time, multiple times or recurrently"
457
  msgstr "Veröffentlichungen zur besten Zeit pro Netzwerk planen: einmalig, mehrmalig oder nach einem regelmäßigen Muster"
458
 
459
+ #: includes/B2S/PostBox.php:157 views/b2s/curation.php:135 views/b2s/post.calendar.php:285 views/b2s/ship.php:313 views/b2s/ship.php:373 views/b2s/ship.php:419
460
  msgid "Schedule and re-share old posts"
461
  msgstr "Plane und teile alte Beiträge"
462
 
463
+ #: includes/B2S/PostBox.php:158 views/b2s/curation.php:136 views/b2s/post.calendar.php:286 views/b2s/ship.php:314 views/b2s/ship.php:374 views/b2s/ship.php:420
464
  msgid "Select link format or image format for your posts"
465
  msgstr "Link-Posts oder Bild-Posts als Posting-Format für Deine Beiträge auswählen"
466
 
467
+ #: includes/B2S/PostBox.php:159 views/b2s/curation.php:137 views/b2s/post.calendar.php:287 views/b2s/ship.php:315 views/b2s/ship.php:375 views/b2s/ship.php:421
468
  msgid "Select individual images per post"
469
  msgstr "Individuelle Bilder für Deine Social Media Posts pro Netzwerk auswählen"
470
 
471
+ #: includes/B2S/PostBox.php:160 views/b2s/curation.php:138 views/b2s/post.calendar.php:288 views/b2s/ship.php:316 views/b2s/ship.php:376 views/b2s/ship.php:422
472
  msgid "Reporting & calendar: keep track of your published and scheduled social media posts"
473
  msgstr "Reporting & Kalender: Verfolge Deine veröffentlichten und geplanten Social Media Beiträge"
474
 
475
+ #: includes/B2S/PostBox.php:162 views/b2s/curation.php:140 views/b2s/post.calendar.php:290 views/b2s/ship.php:318 views/b2s/ship.php:378 views/b2s/ship.php:424
476
  msgid "Upgrade to PREMIUM"
477
  msgstr "Jetzt auf Premium upgraden"
478
 
479
+ #: includes/B2S/PostBox.php:164 views/b2s/curation.php:142 views/b2s/post.calendar.php:292 views/b2s/ship.php:320 views/b2s/ship.php:380 views/b2s/ship.php:426
480
  msgid "or <a href=\"http://service.blog2social.com/trial\" target=\"_blank\">start with free 30-days-trial of Blog2Social Premium</a> (no payment information needed)"
481
  msgstr "oder <a href=\"http://service.blog2social.com/trial\" target=\"_blank\">starte Deinen kostenlosen 30-tägigen Test von Blog2Social Premium</a>(keine Zahlungsinformationen erforderlich)"
482
 
483
  #: includes/B2S/PostBox.php:177 includes/B2S/Curation/View.php:70
484
+ msgid "Select network collection:"
485
+ msgstr "Netzwerk-Gruppierung auswählen:"
486
 
487
  #: includes/B2S/PostBox.php:188 includes/B2S/Curation/View.php:94
488
  msgid "Select Twitter profile:"
506
 
507
  #: includes/B2S/PostBox.php:227
508
  msgid "You want to schedule your blog post with Auto-Poster?"
509
+ msgstr ""
510
 
511
  #: includes/B2S/PostBox.php:227
512
  msgid "Upgrade to PREMIUM PRO"
516
  msgid "Select date:"
517
  msgstr "Datum auswählen:"
518
 
519
+ #: includes/B2S/PostBox.php:234 includes/B2S/Ship/Item.php:359
520
  msgid "show calendar"
521
  msgstr "Planungskalender anzeigen"
522
 
540
  msgid "Get the Blog2Social Browser Extension"
541
  msgstr " Blog2Social Browser Extension installieren"
542
 
543
+ #: views/b2s/curation.draft.php:74
544
+ msgid "Delete Draft"
545
+ msgstr "Entwurf löschen"
546
+
547
+ #: views/b2s/curation.draft.php:77
548
+ msgid "Are you sure you want to delete this draft?"
549
+ msgstr "Bist Du Dir sicher, dass Du den Entwurf löschen möchtest? "
550
+
551
+ #: views/b2s/curation.draft.php:81 views/b2s/curation.php:96 views/b2s/network.php:105 views/b2s/post.approve.php:90 views/b2s/post.approve.php:107 views/b2s/post.draft.php:80 views/b2s/post.notice.php:77 views/b2s/post.publish.php:77 views/b2s/post.sched.php:91
552
+ #: views/b2s/ship.php:469 views/b2s/ship.php:548 views/prg/ship.php:92 views/b2s/widgets/posts.php:67
553
+ msgid "NO"
554
+ msgstr "NEIN"
555
+
556
+ #: views/b2s/curation.draft.php:82 views/b2s/network.php:106 views/b2s/network.php:169 views/b2s/post.approve.php:91 views/b2s/post.draft.php:81 views/b2s/post.notice.php:78 views/b2s/post.publish.php:78 views/b2s/post.sched.php:92 views/b2s/widgets/posts.php:68
557
+ msgid "YES, delete"
558
+ msgstr "Ja, löschen"
559
+
560
  #: views/b2s/curation.php:28
561
  msgid "No link preview available. Please check your link."
562
  msgstr "Keine Link-Vorschau verfügbar. Bitte überprüfe Deinen Link."
593
  msgid "Load data..."
594
  msgstr "Daten werden geladen..."
595
 
596
+ #: views/b2s/curation.php:73 views/b2s/post.calendar.php:37 views/b2s/ship.php:16 views/b2s/ship.php:580 includes/B2S/Post/Filter.php:50 includes/B2S/Post/Item.php:272 includes/B2S/Ship/Save.php:417 includes/PRG/Post/Filter.php:41 includes/PRG/Post/Item.php:97
597
  msgid "published"
598
  msgstr "veröffentlicht"
599
 
600
+ #: views/b2s/curation.php:90 views/b2s/post.approve.php:101 views/b2s/ship.php:463
601
  msgid "Do you want to mark this post as published ?"
602
  msgstr "Möchtest Du diesen Beitrag als veröffentlicht markieren?"
603
 
604
+ #: views/b2s/curation.php:95 views/b2s/post.approve.php:106 views/b2s/ship.php:468 views/b2s/ship.php:549
605
  msgid "YES"
606
  msgstr "JA"
607
 
608
+ #: views/b2s/curation.php:109 views/b2s/post.calendar.php:259 views/b2s/ship.php:393
 
 
 
 
609
  msgid "Need to schedule your posts?"
610
  msgstr "Du möchtest Deine Beiträge planen?"
611
 
612
+ #: views/b2s/curation.php:112 views/b2s/post.calendar.php:262 views/b2s/ship.php:396
613
  msgid "Blog2Social Premium covers everything you need."
614
  msgstr "Blog2Social Premium deckt alles ab, was Du brauchst."
615
 
616
+ #: views/b2s/curation.php:115 views/b2s/post.calendar.php:265 views/b2s/ship.php:399 includes/B2S/Ship/Item.php:806
617
  msgid "Schedule for specific dates"
618
  msgstr "Für bestimmte Termine planen"
619
 
620
+ #: views/b2s/curation.php:116 views/b2s/post.calendar.php:266 views/b2s/ship.php:400
621
  msgid "You want to publish a post on a specific date? No problem! Just enter your desired date and you are ready to go!"
622
  msgstr "Du möchtest einen Beitrag an einem ganz bestimmten Datum veröffentlichen? Kein Problem! Stelle einfach Dein Wunschdatum ein und los geht’s!"
623
 
624
+ #: views/b2s/curation.php:118 views/b2s/post.calendar.php:268 views/b2s/ship.php:402
625
  msgid "Schedule post recurrently"
626
  msgstr "Beitrag mehrfach planen"
627
 
628
+ #: views/b2s/curation.php:119 views/b2s/post.calendar.php:269 views/b2s/ship.php:403
629
  msgid "You have evergreen content you want to re-share from time to time in your timeline? Schedule your evergreen content to be shared once, multiple times or recurringly at specific times."
630
  msgstr "Du möchtest Deine beliebtesten Beiträge wiederholt auf den Social Media teilen? Teile Deine Evergreen Inhalte einmal, mehrmals oder in einem wiederkehrenden Rhythmus"
631
 
632
+ #: views/b2s/curation.php:121 views/b2s/post.calendar.php:271 views/b2s/ship.php:405
633
  msgid "Best Time Scheduler"
634
  msgstr "Beste Zeiten Manager"
635
 
636
+ #: views/b2s/curation.php:122 views/b2s/post.calendar.php:272 views/b2s/ship.php:406
637
  msgid "Whenever you publish a post, only a fraction of your followers will actually see your post. Use the Blog2Social Best Times Scheduler to share your post at the best times for each social network. Get more outreach and extend the lifespan of your posts."
638
  msgstr ""
639
  "Wenn Du einen Post in den Social Media veröffentlichst, wird Dein Beitrag immer nur von einer kleinen Anzahl Deiner Follower wahrgenommen. Nutze den Beste Zeiten Manager, um Deine Beiträge zu den besten Zeiten des jeweiligen Netzwerks zu teilen. Steigere so die Reichweite, "
640
  "Interaktion und Lebensdauer Deiner Posts."
641
 
642
+ #: views/b2s/dashboard.php:16
643
  msgid "What's New"
644
  msgstr "Das ist neu"
645
 
646
+ #: views/b2s/dashboard.php:26
647
  msgid "Your Activity"
648
  msgstr "Deine Aktivitäten"
649
 
650
+ #: views/b2s/dashboard.php:31
651
  msgid "List"
652
  msgstr "Liste"
653
 
654
+ #: views/b2s/dashboard.php:32
655
  msgid "Chart"
656
  msgstr "Diagramm"
657
 
658
+ #: views/b2s/dashboard.php:60
659
  msgid "Follow us"
660
  msgstr "Folge uns"
661
 
675
  msgid "Delete"
676
  msgstr "Löschen"
677
 
678
+ #: views/b2s/network.php:44 views/b2s/ship.php:72 views/b2s/ship.php:363
679
  msgid "You want to schedule your posts and use the Best Time Scheduler?"
680
  msgstr "Du möchtest die Veröffentlichung Deiner Posts planen und den Beste Zeiten Manager benutzen?"
681
 
682
+ #: views/b2s/network.php:45 views/b2s/ship.php:73
683
  msgid "Load Best Times"
684
  msgstr "Lade beste Zeiten"
685
 
695
  msgid "Do you really want to delete this profile"
696
  msgstr "Soll Dein Profil wirklich gelöscht werden?"
697
 
698
+ #: views/b2s/network.php:117 views/b2s/premium.php:127
 
 
 
 
699
  msgid "Google My Business"
700
  msgstr "Google My Business"
701
 
709
  msgid "Google currently allows access to the API for all companies with up to 9 locations in their Google My Business Listings. However, Google plans to extend the API for companies with more than 9 locations in their Google My Business listings."
710
  msgstr "Google erlaubt derzeit den Zugriff auf die API für alle Unternehmen mit bis zu 9 Standorten. Google plant, den Zugriff auf die API in Zukunft auch auf Unternehmen mit mehr als 9 verbundenen Standorten in Ihren Google My Business Brancheneinträgen zu erweitern."
711
 
712
+ #: views/b2s/network.php:126 views/b2s/premium.php:36 views/b2s/ship.php:485 includes/B2S/Ship/Item.php:844 views/b2s/partials/post-edit-modal.php:48
713
  msgid "Learn more"
714
  msgstr "Mehr erfahren"
715
 
776
  #: views/b2s/network.php:228 views/b2s/network.php:310
777
  msgid "Move the connection to another network collection."
778
  msgstr ""
 
779
 
780
  #: views/b2s/network.php:233 views/b2s/network.php:262 views/b2s/network.php:265 views/b2s/network.php:268
781
  msgid "An error occured. Please contact our support."
782
  msgstr ""
 
783
 
784
  #: views/b2s/network.php:240 views/b2s/network.php:317
785
  msgid "move"
837
  msgid "Upgrade to Blog2Social Business"
838
  msgstr "Upgrade auf Blog2Social Business"
839
 
840
+ #: views/b2s/network.php:315 includes/B2S/Ship/Navbar.php:37
841
  msgid "My Profile"
842
  msgstr "Mein Profil"
843
 
844
+ #: views/b2s/network.php:346 includes/B2S/Network/Item.php:158
845
+ msgid "Edit Post Template"
846
+ msgstr "Beitragsvorlage bearbeiten"
847
 
848
  #: views/b2s/network.php:358 views/b2s/settings.php:54
849
  msgid "save"
857
  msgid ""
858
  "Please enable this feature, if you are using varnish caching (HTTP accelerator to relieve your website). Blog2Social will add a \"no-cache=1\" parameter to the post URL of your Facebook link posts to ensure that Facebook always pulls the current meta data of your blog post."
859
  msgstr ""
 
 
860
 
861
  #: views/b2s/network.php:384
862
  msgid "Choose your Post Format"
863
+ msgstr ""
864
 
865
  #: views/b2s/network.php:388 views/b2s/network.php:391 views/b2s/network.php:394
866
  msgid "Decide in which post format you want to post your content: Link post or image post."
867
+ msgstr ""
868
 
869
  #: views/b2s/network.php:397
870
  msgid "Decide in wich form you want to post your Content. Either as image with frame, or as image cut out."
871
+ msgstr ""
872
 
873
  #: views/b2s/network.php:409
874
  msgid "Post Content"
875
+ msgstr ""
876
 
877
  #: views/b2s/network.php:412
878
  msgid "Edit the content of your post. Move elements by drag and drop into the textarea and customize them as you like."
879
+ msgstr ""
880
 
881
  #: views/b2s/network.php:415
882
  msgid "Legend"
883
+ msgstr ""
884
 
885
  #: views/b2s/network.php:417
886
  msgid "The title of your post"
887
+ msgstr ""
888
 
889
  #: views/b2s/network.php:418
890
  msgid "The summary of your post (you define it in the side menu of your post)."
891
+ msgstr ""
892
 
893
  #: views/b2s/network.php:419
894
  msgid "The content of your post"
895
+ msgstr ""
896
 
897
  #: views/b2s/network.php:420
898
  msgid "The tags you have set in your post."
899
+ msgstr ""
900
 
901
  #: views/b2s/network.php:433 includes/B2S/Network/Item.php:624
902
  msgid "Character limit"
903
+ msgstr ""
904
 
905
  #: views/b2s/network.php:436
906
  msgid "Define the character limit for the variables \"EXCERPT\" and \"CONTENT\" individually. Your text will be shortened after the last comma, period, or space character within your character limit."
907
+ msgstr ""
908
 
909
  #: views/b2s/network.php:437
910
  msgid "An \"EXCERPT\" will only be added to your social media post if you have added a manual excerpt in the excerpt editing box of the Gutenberg side menu (document settings) of your post."
911
  msgstr ""
 
912
 
913
  #: views/b2s/network.php:438
914
  msgid ""
915
  "\"TITLES\" and \"KEYWORDS\" (Hashtags) are not shortened. If you select the \"TITLE\" and \"KEYWORD\" variables for your social media posts, the character limit you define for the \"EXCERPT\" and/or \"CONTENT\" variables will be applied within the remaining available "
916
  "character limit of the social network."
917
  msgstr ""
 
 
918
 
919
  #: views/b2s/post.approve.php:81
920
  msgid "Delete Social Media Posts"
936
  msgid "show all"
937
  msgstr "alles anzeigen"
938
 
939
+ #: views/b2s/post.calendar.php:38 views/b2s/ship.php:16 includes/B2S/Post/Filter.php:50 includes/B2S/Post/Item.php:272 includes/PRG/Post/Filter.php:41 includes/PRG/Post/Item.php:97
940
  msgid "scheduled"
941
  msgstr "geplant"
942
 
946
 
947
  #: views/b2s/post.calendar.php:69 views/b2s/post.sched.php:177 includes/B2S/Settings/Item.php:393 includes/B2S/Settings/Item.php:412
948
  msgid "Image Post"
949
+ msgstr ""
950
 
951
  #: views/b2s/post.calendar.php:86 views/b2s/post.sched.php:164
952
  msgid "add post"
953
  msgstr "Beitrag hinzufügen"
954
 
955
+ #: views/b2s/post.calendar.php:105 views/b2s/post.sched.php:122 views/b2s/ship.php:498
956
  msgid "Choose your"
957
  msgstr "Wähle Deinen"
958
 
959
+ #: views/b2s/post.calendar.php:105 views/b2s/post.sched.php:122 views/b2s/ship.php:498
960
  msgid "Post Format"
961
  msgstr "Postformat"
962
 
963
+ #: views/b2s/post.calendar.php:107 views/b2s/post.sched.php:124 views/b2s/ship.php:500
964
  msgid "for:"
965
  msgstr "für:"
966
 
967
+ #: views/b2s/post.calendar.php:126 views/b2s/post.sched.php:143 views/b2s/ship.php:518
968
  msgid "Define the default settings for the custom post format for all of your Facebook accounts in the Blog2Social settings."
969
  msgstr "Speichere Dein bevorzugtes Facebook Post-Format als Standardeinstellung in den Blog2Social Einstellungen."
970
 
971
+ #: views/b2s/post.calendar.php:129 views/b2s/post.sched.php:146 views/b2s/ship.php:521
972
  msgid "Define the default settings for the custom post format for all of your Twitter accounts in the Blog2Social settings."
973
  msgstr "Definiere Dein Standard-Beitragsformat für alle Deine Twitter-Verbindungen unter den Blog2Social Einstellungen."
974
 
975
+ #: views/b2s/post.calendar.php:132 views/b2s/post.sched.php:149 views/b2s/ship.php:524
976
  msgid "Define the default settings for the custom post format for all of your LinkedIn accounts in the Blog2Social settings."
977
  msgstr "Definiere die Standardeinstellung für das Postformat bei LinkedIn in den Blog2Social-Einstellungen."
978
 
979
+ #: views/b2s/post.calendar.php:135 views/b2s/post.sched.php:152 views/b2s/ship.php:527
980
  msgid "Define the default settings for the custom post format for all of your Instagram accounts in the Blog2Social settings."
981
  msgstr "Definiere die Standardeinstellungen für das benutzerdefinierte Postformat für alle Instagram-Konten in den Blog2Social-Einstellungen."
982
 
983
+ #: views/b2s/post.calendar.php:150 views/b2s/post.sched.php:103 views/b2s/ship.php:439
984
  msgid "Select image for"
985
  msgstr "Wähle Bild aus für"
986
 
1004
  msgid "Select a post"
1005
  msgstr "Wähle einen Beitrag aus"
1006
 
1007
+ #: views/b2s/post.draft.php:73
1008
+ msgid "Delete Social Media Draft"
1009
+ msgstr ""
1010
+
1011
+ #: views/b2s/post.draft.php:76
1012
+ msgid "Are you sure you want to delete this Social Media draft?"
1013
+ msgstr ""
1014
+
1015
  #: views/b2s/post.notice.php:68 views/b2s/post.publish.php:68 views/b2s/widgets/posts.php:58
1016
  msgid "Delete entries from the reporting"
1017
  msgstr "Einträge aus dem Reporting löschen"
1032
  msgid "You are sure, you want to delete entries from the scheduling?"
1033
  msgstr "Bist Du sicher, dass Du Einträge aus Deiner Planung löschen möchtest?"
1034
 
1035
+ #: views/b2s/premium.php:14 includes/B2S/Settings/Item.php:156
1036
  msgid "Your current license:"
1037
  msgstr "Deine aktuelle Lizenz:"
1038
 
1039
+ #: views/b2s/premium.php:26
1040
  msgid "Try Blog2Social Premium 30 days for free"
1041
  msgstr "Teste Blog2Social Premium 30 Tage lang kostenlos."
1042
 
1043
+ #: views/b2s/premium.php:30
1044
  msgid "End of Trial"
1045
  msgstr "Ende der Testzeit"
1046
 
1047
+ #: views/b2s/premium.php:31 includes/B2S/Settings/Item.php:159 includes/B2S/Settings/Item.php:162
1048
  msgid "Upgrade"
1049
  msgstr "Upgrade"
1050
 
1051
+ #: views/b2s/premium.php:35
1052
  msgid "Upgrade to Blog2Social Premium and get even smarter with social media automation: Schedule your posts for the best time or recurringly with the Best Time Manager or the Social Media Calendar. Post to pages, groups and multiple accounts per network."
1053
  msgstr ""
1054
  "Nutze Blog2Social Premium für noch intelligentere Social Media Automatisierung: Plane Deine Beiträge voll-automatisiert mit dem Beste-Zeiten-Manager, wähle bestimmte Termine oder plane Deine Beiträge regelmäßig. Behalte den Überblick über Deine Posts mit dem Social Media "
1055
  "Kalender. Veröffentliche Beiträge auf Seiten, in Gruppen und auf mehreren Konten pro Netzwerk. Arbeite mit mehr Nutzern im Team. "
1056
 
1057
+ #: views/b2s/premium.php:41
1058
  msgid "Select a user"
1059
  msgstr " Blog-Benutzer auswählen"
1060
 
1061
+ #: views/b2s/premium.php:45
1062
  msgid "No User found"
1063
  msgstr "Kein Blog-Benutzer gefunden"
1064
 
1065
+ #: views/b2s/premium.php:48
1066
  msgid "Enter license key and change your version"
1067
  msgstr "Lizenzschlüssel eingeben und Version ändern"
1068
 
1069
+ #: views/b2s/premium.php:50
1070
  msgid "Activate License"
1071
+ msgstr ""
1072
 
1073
+ #: views/b2s/premium.php:61
1074
  msgid "Go Premium and get even smarter with social media automation"
1075
  msgstr "Nutze Blog2Social Premium für noch intelligentere Social Media Automatisierung"
1076
 
1077
+ #: views/b2s/premium.php:70
1078
  msgid "Pages and groups"
1079
  msgstr "Seiten und Gruppen"
1080
 
1081
+ #: views/b2s/premium.php:71
1082
  msgid "Share your posts on pages and in groups on Facebook, LinkedIn, XING, VK and Medium."
1083
  msgstr "Teilen Sie Ihre Beiträge auf Seiten und in Gruppen auf Facebook, LinkedIn, Xing, VK und Medium."
1084
 
1085
+ #: views/b2s/premium.php:79
1086
  msgid "More users and accounts"
1087
  msgstr "Mehr Benutzer und Accounts"
1088
 
1089
+ #: views/b2s/premium.php:80
1090
  msgid "Add multiple users and accounts per network. Define sharing-profiles for selected network bundles."
1091
  msgstr "Füge mehrere Benutzer und Accounts pro Netzwerk hinzu. Definiere Sharing-Profile für ausgewählte Netzwerk-Bundles."
1092
 
1093
+ #: views/b2s/premium.php:88
1094
  msgid "Social Media Calendar"
1095
  msgstr "Social Media Kalender"
1096
 
1097
+ #: views/b2s/premium.php:89
1098
  msgid "See your entire schedule at a glance, with team view and network filter. Edit scheduled posts or add new social media posts per drag & drop."
1099
  msgstr "Sieh Deinen gesamten Zeitplan auf einen Blick, mit Teamansicht und Netzwerkfilter. Bearbeite geplante Beiträge oder füge neue Social-Media-Beiträge per Drag & Drop hinzu."
1100
 
1101
+ #: views/b2s/premium.php:97
1102
  msgid "Best Times Manager"
1103
  msgstr "Beste Zeiten Manager"
1104
 
1105
+ #: views/b2s/premium.php:98
1106
  msgid "Use the Best Times Manager to schedule your posts automatically or define your own best time scheme."
1107
  msgstr "Verwende den Beste-Zeiten-Manager, um Deine Beiträge automatisch zu planen oder Dein eigenes bestes Zeitschema zu definieren."
1108
 
1109
+ #: views/b2s/premium.php:109 views/b2s/settings.php:34 includes/B2S/Post/Item.php:539
1110
  msgid "Auto-Posting"
1111
  msgstr "Auto-Posting"
1112
 
1113
+ #: views/b2s/premium.php:110
1114
  msgid "Share your posts automatically across your preferred networks at once or at your pre-scheduled time-settings."
1115
  msgstr "Teile Deine Beiträge automatisch in Deinen bevorzugten Netzwerken sofort oder zu den von Dir festgelegten Zeiten."
1116
 
1117
+ #: views/b2s/premium.php:118
1118
  msgid "RSS import & auto-post"
1119
  msgstr "RSS-Import & Auto-Poster"
1120
 
1121
+ #: views/b2s/premium.php:119
1122
  msgid "Share imported RSS feeds automatically to get more variations for your content."
1123
  msgstr "Teile importierte RSS-Feeds automatisch, um mehr Variationen für Deine Inhalte zu erhalten."
1124
 
1125
+ #: views/b2s/premium.php:128
1126
  msgid "Schedule and share your blog posts as Google My Business posts to update your business listing and to add fresh content for your company."
1127
  msgstr "Plane und teile Deine Blogartikel als Google My Business - Beiträge und verleihe Deinem Unternehmen mit aktuellen News mehr Sichtbarkeit."
1128
 
1129
+ #: views/b2s/premium.php:136
1130
  msgid "Schedule curated content"
1131
  msgstr "Kuratierte Inhalte planen"
1132
 
1133
+ #: views/b2s/premium.php:137
1134
  msgid "Schedule and share curated content from any source on your preferred networks."
1135
  msgstr "Plane und teile kuratierte Inhalte aus beliebigen Quellen in Deinen bevorzugten Netzwerken."
1136
 
1137
+ #: views/b2s/premium.php:148
1138
  msgid "Custom image"
1139
  msgstr "Benutzerdefinierte Bilder"
1140
 
1141
+ #: views/b2s/premium.php:149
1142
  msgid "Select individual images per post or network and select any image from your media library to create more variations for your posts."
1143
  msgstr "Wähle individuelle Bilder pro Beitrag oder Netzwerk sowie ein beliebiges Bild aus Deiner Mediathek aus, um weitere Variationen für Deine Beiträge zu erstellen."
1144
 
1145
+ #: views/b2s/premium.php:157
1146
  msgid "Custom format"
1147
  msgstr "Benutzerdefiniertes Format"
1148
 
1149
+ #: views/b2s/premium.php:158
1150
  msgid "Select link post or image post per network to choose the optimal format for your post."
1151
  msgstr "Wähle zwischen Link- oder Bild-Post pro Netzwerk, um das optimale Format für Deinen Beitrag zu wählen"
1152
 
1153
+ #: views/b2s/premium.php:166
1154
  msgid "Open Graph and Twitter Card Tags"
1155
  msgstr "Open Graph und Twitter Card Tags"
1156
 
1157
+ #: views/b2s/premium.php:167
1158
  msgid "Add and edit meta tags for Open Graph (Ex. Facebook and LinkedIn) and Twitter Cards to define the look of your link posts."
1159
  msgstr "Setze und bearbeite Social-Media-Tags für Open Graph (z.B. Facebook und LinkedIn) und Twitter Cards, um das Aussehen Deiner Link-Posts festzulegen."
1160
 
1161
+ #: views/b2s/premium.php:175
1162
  msgid "Premium support"
1163
  msgstr "Premium Support"
1164
 
1165
+ #: views/b2s/premium.php:176
1166
  msgid "Regular updates and priority support per e-mail and phone."
1167
  msgstr "Regelmäßige Updates und bevorzugter Support per E-Mail und Telefon"
1168
 
1169
+ #: views/b2s/premium.php:181
1170
  msgid "Show me plans and prices"
1171
  msgstr "Versionen und Preise anzeigen"
1172
 
1173
+ #: views/b2s/premium.php:182
1174
  msgid "Show all premium features"
1175
  msgstr "Alle Premium-Features anzeigen"
1176
 
1247
  "Die Zeiteinstellungen zum Planen von Social Media Posts in Blog2Social basieren auf der Zeitzone, die in den allgemeinen Einstellungen Deines WordPress festgelegt ist. Du kannst aber auch eine andere Zeitzone als Basis für die Planung Deiner Social Media Posts festlegen. "
1248
  "Wähle dazu die gewünschte Zeitzone aus dem Drop-Down Menü."
1249
 
1250
+ #: views/b2s/ship.php:16 includes/B2S/Post/Filter.php:50 includes/B2S/Post/Item.php:272 includes/PRG/Post/Item.php:97
1251
  msgid "draft"
1252
  msgstr "Entwurf"
1253
 
1254
+ #: views/b2s/ship.php:50
1255
  msgid "Social Media Scheduling & Sharing"
1256
  msgstr "Beitrag auf Social Media planen und teilen"
1257
 
1258
+ #: views/b2s/ship.php:51 views/prg/ship.php:41 views/prg/ship.php:43 includes/B2S/Curation/View.php:35 includes/B2S/Settings/Item.php:317 includes/B2S/Settings/Item.php:338
1259
  msgid "Title"
1260
  msgstr "Titel"
1261
 
1262
+ #: views/b2s/ship.php:53 includes/B2S/Post/Item.php:316
1263
  msgid "on blog"
1264
  msgstr "auf dem Blog"
1265
 
1266
+ #: views/b2s/ship.php:61
1267
  msgid "scroll to bottom"
1268
  msgstr "zum Seitenende"
1269
 
1270
+ #: views/b2s/ship.php:66
1271
  msgid "You want to load your time settings?"
1272
  msgstr "Du möchtest Deine Zeiten laden?"
1273
 
1274
+ #: views/b2s/ship.php:67
1275
  msgid "Load My Times Settings"
1276
  msgstr "Meine Zeit-Einstellungen laden"
1277
 
1278
+ #: views/b2s/ship.php:103
1279
  msgid "Social Accounts"
1280
  msgstr "Social Media Konten"
1281
 
1282
+ #: views/b2s/ship.php:121
1283
  msgid "Add more..."
1284
  msgstr "mehr hinzufügen"
1285
 
1286
+ #: views/b2s/ship.php:123
1287
  msgid "Profiles | Pages | Groups"
1288
  msgstr "Profile | Seiten | Gruppen"
1289
 
1290
+ #: views/b2s/ship.php:162
1291
  msgid "Save network collection"
1292
+ msgstr "Speicher Netzwerk-Gruppierung"
1293
 
1294
+ #: views/b2s/ship.php:171
1295
  msgid "network connected"
1296
  msgstr "Netzwerk verbunden"
1297
 
1298
+ #: views/b2s/ship.php:172
1299
  msgid "requires image"
1300
  msgstr "Bild benötigt"
1301
 
1302
+ #: views/b2s/ship.php:173
1303
  msgid "refresh authorization"
1304
  msgstr "Autorisierung aktualisieren"
1305
 
1306
+ #: views/b2s/ship.php:196
1307
  msgid "Notice:<br><p>Please make sure, that your website address is reachable. The Social Networks do not allow postings from local installations.</p>"
1308
  msgstr "Hinweis:<br><p>Bitte stelle sicher, dass Deine Webseiten-Adresse von außen erreichbar ist. Die sozialen Netzwerke erlauben keine Posts von lokalen Installationen.</p>"
1309
 
1310
+ #: views/b2s/ship.php:198
1311
  msgid "change website address"
1312
  msgstr "Webseiten-Adresse ändern"
1313
 
1314
+ #: views/b2s/ship.php:215
1315
  msgid "First, connect or select network before posting"
1316
  msgstr "Verbinde Dich zuerst mit einem Netzwerk oder wähle ein Netzwerk aus, bevor Du den Beitrag teilst!"
1317
 
1318
+ #: views/b2s/ship.php:217 includes/B2S/Settings/Item.php:81
1319
  msgid "connect"
1320
  msgstr "Jetzt mit Netzwerken verbinden"
1321
 
1322
+ #: views/b2s/ship.php:225
1323
  msgid "scroll to top"
1324
  msgstr "zum Seitenanfang"
1325
 
1326
+ #: views/b2s/ship.php:226 views/b2s/ship.php:232 includes/B2S/Curation/View.php:111
1327
  msgid "Share"
1328
  msgstr "Teilen"
1329
 
1330
+ #: views/b2s/ship.php:227 views/b2s/ship.php:231 includes/B2S/Curation/View.php:107
1331
+ msgid "Save as Draft"
1332
+ msgstr "als Entwurf speichern"
1333
+
1334
+ #: views/b2s/ship.php:241
1335
  msgid "Time zone"
1336
  msgstr "Zeitzone"
1337
 
1338
+ #: views/b2s/ship.php:255 views/b2s/ship.php:257 includes/B2S/Post/Item.php:333
1339
  msgid "Re-share this post"
1340
  msgstr "Diesen Beitrag nochmal teilen"
1341
 
1342
+ #: views/b2s/ship.php:259
1343
  msgid "Share new post on Social Media"
1344
  msgstr "Teile einen neuen Beitrag auf Social Media"
1345
 
1346
+ #: views/b2s/ship.php:281
1347
  msgid "Connect for"
1348
  msgstr "Netzwerke verbinden für"
1349
 
1350
+ #: views/b2s/ship.php:297
1351
  msgid "Re-share this Post"
1352
  msgstr "Diesen Beitrag nochmal teilen"
1353
 
1354
+ #: views/b2s/ship.php:300
1355
  msgid ""
1356
  "You can re-share your post for a different sharing purpose, or to share on a different choice of networks, profiles, pages or groups, or with different comments or images, or if you want to share your blog post images to image networks only, or re-share them at different "
1357
  "times. You may vary your comments and images in order to produce more variations of your social media posts to share more often without sharing the same message over and over again. Whatever your choose to do for re-sharing your post, you can simply click \"Re-share this "
1361
  "oder um weitere Bilder zum Blogbeitrag nur an die Bilder-Netzwerke zu senden, oder um Deine Social Media Posts zu anderen Zeiten zu teilen. So erzielt Du mehr Variationen Deiner Social Media Posts und kannst Deinen Beitrag öfters posten, um mehr Aufmerksamkeit und Reichweite "
1362
  "zu erzielen, ohne immer wieder die gleiche Mitteilung zu posten. Was auch immer Du zu teilen wünscht, klicke einfach auf \"Diesen Beitrag erneut teilen\" und Du wirst erneut zur Vorschau geführt, wo Deine Netzwerke, Texte und Bilder auswählen oder variieren kannst. "
1363
 
1364
+ #: views/b2s/ship.php:303
1365
  msgid "You want re-share your blog post?"
1366
  msgstr "Du möchtest Deinen Beitrag erneut teilen?"
1367
 
1368
+ #: views/b2s/ship.php:331
1369
  msgid "Save Network Settings"
1370
  msgstr "Netzwerkeinstellungen speichern"
1371
 
1372
+ #: views/b2s/ship.php:334
1373
  msgid ""
1374
  "You can save your current network settings as \"Standard\" network settings for any future sharing activities or as a \"Profile\" to choose from (Premium).<br><br>Your Standard selection will show as activated upon pressing the \"share on social media\" button on the right "
1375
  "hand side bar. You can change these settings any time per click, or choose another network profile (Premium).<br><br>You can also pre-define various different sets of networks, for specific social media accounts, target groups, contents or sharing purposes. For example you "
1382
  "posten, um mehr Aufmerksamkeit und Reichweite zu erzielen, ohne immer wieder die gleiche Mitteilung zu posten. Was auch immer Du zu teilen wünscht