PluginProbe
Taboola / 2.0.2
Taboola v2.0.2
1.0.4 1.0.5 1.0.6 1.0.8 2.0.1 2.0.2 2.1.0 2.1.1 2.2.2 2.2.3 3.0.0 3.0.1 3.0.2 3.1.0 trunk 1.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.2 1.0.3
← All changes | settings.php +623 -427 trunk2.0.2 View file →
@@ -1,4 +1,5 @@
1 +<!-- Latest font-awesome include-->
1 2 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
2 3
3 4 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
4 5 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
@@ -4,38 +5,417 @@
4 5 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
5 6 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
6 7
7 8 <style>
8 - <?php include 'css/main.css'; ?>
9 +
10 + .taboola-container {
11 + padding: 20px;
12 + padding-left: 0;
13 + font-size: 14px;
14 + background-color: #FAF9F6;
15 + font-family: Roboto,Lato,Hind -apple-system,Helvetica Neue,sans-serif;
16 + }
17 +
18 + .settings_block {
19 + background-color: #fff;
20 + border: 1px solid #d4d9df;
21 + border-radius: 8px;
22 + margin-top: 10px;
23 + width: 50%;
24 + }
25 +
26 + .settings_block.widget_settings_block { /* Give the widget settings block some extra space at the end */
27 + padding-bottom: 15px;
28 + }
29 +
30 + .settings_block input {
31 + border-color: #ccc; /* Most of the inputs are styled via jQuery. This is for any others - e.g. #publisher-id */
32 + }
33 +
34 + .publisher_welcome_massage{
35 + float: right;
36 + width: 36%;
37 + padding: 20px 10px 10px 0px;
38 + margin: 40px 6% 0 0;
39 + background: #FFFACD;
40 + border: 1px solid #d4d9df;
41 + border-radius: 20px;
42 + }
43 +
44 + .switch_style{
45 + margin : 10px 10px 20px 10px;
46 + }
47 +
48 + .style_box1, .pub_id{
49 + padding: 10px 10px 0px 20px;
50 + }
51 +
52 + .statement{
53 + padding: 10px 10px 10px 20px;
54 + }
55 +
56 + .widget_below, .widget_below_mid, .widget_below_mid_selector, .widget_below_home, .widget_below_home_selector{
57 + width: 50%;
58 + float: left;
59 + padding: 5px 0px 0px 20px;
60 + }
61 +
62 + .mode_style, .mode_style_mid, .mode_style_home, .mode_style_home_selector{
63 + width: 50%;
64 + padding: 0px 0px 3px 20px;
65 + float:left;
66 + }
67 +
68 + .placement_style, .placement_style_mid, .placement_style_home_occurrence,.placement_style_home {
69 + padding: 0px 0px 8px 0px;
70 + width: 50%;
71 + float: right;
72 + }
73 +
74 + .widget_below_mid_selector{
75 + padding: 8px 0px 0px 0px;
76 + }
77 +
78 + .placement_below_mid_occurrence,.mode_style_mid_selector {
79 + padding: 0px 0px 8px 20px;
80 + }
81 +
82 + .heading_mid_home{
83 + padding: 20px 0px 8px 20px;
84 + }
85 +
86 + #mid_occurrence_div, #mid_css_selector_div {
87 + width: 50%;
88 + float: left;
89 + margin: 19px 0px 0px 0px;
90 + }
91 +
92 + /* slider button CSS */
93 +
94 + .switch {
95 + position: relative;
96 + display: inline-block;
97 + width: 45px;
98 + height: 20px;
99 + float: right;
100 + }
101 +
102 + .switch input {
103 + opacity: 0;
104 + width: 0;
105 + height: 0;
106 + }
107 +
108 + .slider {
109 + position: absolute;
110 + cursor: pointer;
111 + top: 0;
112 + left: 0;
113 + right: -1px;
114 + bottom: 0;
115 + background-color: #ccc;
116 + -webkit-transition: .4s;
117 + transition: .4s;
118 + }
119 +
120 + .slider:before {
121 + position: absolute;
122 + content: "";
123 + height: 18px;
124 + width: 18px;
125 + left: 1px;
126 + bottom: 1px;
127 + background-color: white;
128 + -webkit-transition: .4s;
129 + transition: .4s;
130 + }
131 +
132 + input:checked + .slider {
133 + background-color: #0f4c81;
134 + }
135 +
136 + input:focus + .slider {
137 + box-shadow: 0 0 1px #0f4c81;
138 + }
139 +
140 + input:checked + .slider:before {
141 + -webkit-transform: translateX(26px);
142 + -ms-transform: translateX(26px);
143 + transform: translateX(26px);
144 + }
145 +
146 + /* Rounded sliders */
147 +
148 + .slider.round {
149 + border-radius: 34px;
150 + }
151 +
152 + .slider.round:before {
153 + border-radius: 50%;
154 + }
155 +
156 + /* slider button CSS */
157 +
158 + .request_link {
159 + float: right;
160 + margin-right: 10px;
161 + line-height: 26px;
162 + }
163 +
164 +/* hide and position tooltip */
165 +
166 + .tooltip div{
167 + visibility: hidden;
168 + width: auto;
169 + display: inline-block;
170 + background: #0f4c81;
171 + color: #ffffff;
172 + font-weight: normal;
173 + font-size: 12px;
174 + border-radius: 6px;
175 + padding: 5px;
176 + margin-left: 5px;
177 + max-width: 350px;
178 + position: absolute;
179 + z-index: 999;
180 + transition-delay: 0.25s;
181 + }
182 +
183 + .tooltip div a:hover{
184 + text-decoration: underline;
185 + }
186 +
187 + .tooltip{
188 + opacity: 1 !important;
189 + font-size: 13px !important;
190 + display: contents !important;
191 + }
192 +
193 + .tooltip:hover div{
194 + visibility: visible;
195 + transition-delay: 0.5s;
196 + }
197 +
198 + .tooltip div a{
199 + text-decoration: none;
200 + font-weight: bold;
201 + color: #fff;
202 + }
203 +
204 + .label-success {
205 + background: #a4fba6 !important;
206 + border: 1px solid #d2f2d4;
207 + border-radius: 10px;
208 + padding: 10px 30px 20px 10px;
209 + font-size: 14px;
210 + display: block;
211 + margin-top: 10px;
212 + color: green;
213 + width: 50%;
214 + }
215 + .label-error {
216 + background: #ffbaba;
217 + border: 1px solid #ffbaba;
218 + border-radius: 10px;
219 + padding: 10px 30px 20px 10px;
220 + font-size: 14px;
221 + display: block;
222 + margin-top: 10px;
223 + color: red;
224 + width: 50%;
225 + }
226 +
227 + .label-error ul {
228 + list-style-position: inside;
229 + list-style-type: disc;
230 + text-indent: 2em;
231 + }
232 +
233 + .label-error p {
234 + font-size: 14px;
235 + }
236 +
237 + .change_button{
238 + float: right;
239 + }
240 +
241 + .apply_button{
242 + /* margin-top: 20px; */
243 + background-color: #0f4c81;
244 + color: #fff;
245 + padding: 0.8rem 1rem;
246 + border-radius: 7px;
247 + border: transparent;
248 + float: right;
249 + }
250 +
251 + .apply_button:hover {
252 + background-color: #1261A0;
253 + cursor: pointer;
254 + }
255 +
256 + .helpTooltip__icon___1XWGN,
257 + .helpTooltip__icon___1XWGN_read{
258 + color: #b8c1ca;
259 + width: 1em;
260 + height: 1em;
261 + margin: 4px;
262 + }
263 +
264 + .helpTooltip__icon___1XWGN_read{
265 + margin-top: 4px;
266 + }
267 +
268 + .helpTooltip__icon___1XWGN_first{
269 + color: #b8c1ca;
270 + width: 1em;
271 + height: 1em;
272 + }
273 +
274 + .checkbox_read{
275 + padding: 0px 0px 5px 20px;
276 + float: left;
277 + }
278 +
279 + label:hover{
280 + cursor: default;
281 + }
282 +
283 + ::placeholder{
284 + color: #DEDEDE;
285 + }
286 +
287 + .widget_h2,.general_h2{
288 + font-size: 18px;
289 + font-weight: 500;
290 + }
291 +
292 + .list_l1{
293 + border-top: 1px solid #DEDEDE;
294 + margin: 30px 20px 0px 0px;
295 + margin-left: 14%;
296 + }
297 +
298 + .theme_image{
299 + width: 50%;
300 + }
301 +
302 + .welcome_heading{
303 + margin-left: 8%;
304 + font-size: 1.5em;
305 + }
306 +
307 + .first_p,
308 + .second_p{
309 + margin-left: 14%;
310 + font-size: 14px;
311 + }
312 +
313 + .list_l1 p{
314 + font-size: 13px;
315 + }
316 +
317 + input#publisher-id,
318 + input#first_bc_placement,
319 + input#mid_placement,
320 + input#home_placement{
321 + width: 36%;
322 + }
323 +
324 + input#first_bc_widget_id,
325 + input#mid_widget_id,
326 + input#mid_location_string,
327 + input#home_widget_id,
328 + input#home_location_string{
329 + width: 77%;
330 + }
331 +
332 + label{
333 + font-weight: normal !important;
334 + }
335 +
336 + label#pub_id{
337 + color: #000000;
338 + }
339 +
340 + input#out_of_content_enabled {
341 + height: 16px;
342 + width: 16px;
343 + }
344 +
345 + input[type=checkbox]:checked::before {
346 + width: 1.8rem !important;
347 + }
348 +
349 + input[type=checkbox]:focus {
350 + outline: none !important;
351 + outline-offset: 0px !important;
352 + }
353 +
354 + input[type=checkbox]{
355 + margin: -5px 0 0;
356 + }
357 +
358 + #homepage{
359 + display: none;
360 + }
361 +
362 + #show-advanced-settings{
363 + text-decoration: none;
364 + color: #666666;
365 + margin-top: 5px;
366 + cursor: pointer;
367 + float: left;
368 + width: 50%;
369 + font-family: Roboto, Lato, "Hind -apple-system", "Helvetica Neue", sans-serif;
370 + font-style: italic;
371 + }
372 +
373 + #advanced-settings-main{
374 + margin: 10px 0px 0px 10px;
375 + width: 49%;
376 + }
377 +
378 + div#mid_article {
379 + padding-bottom: 100px;
380 + }
381 +
382 + #mid_css_selector_div{
383 + display: none;
384 + }
385 +
386 + input.highlight {
387 + border: 1px solid orange !important;
388 + }
389 +
9 390 </style>
10 391
392 +<?php
393 +
394 +// $short_version =strlen(TABOOLA_PLUGIN_VERSION) == 5 ? substr(TABOOLA_PLUGIN_VERSION,0,3) : ""; // E.g. '2.1.0' => '2.1' (else '')
395 +
396 +?>
397 +
398 + <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
399 + <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> -->
400 +
401 +
11 402 <div class="taboola-container">
12 403 <div class="theme_image">
13 404 <img src='<?php echo $this->plugin_url.'img/taboola.png' ?>' style='width:150px;'/>
14 405 </div>
15 406
16 - <h2 style="font-size:1.7em;">Taboola WordPress Plugin</h2>
407 + <h2 style="font-size:1.7em;">Taboola WordPress Plugin 2</h2>
17 408
18 - <h2 class="nav-tab-wrapper">
19 - <a href="#tab1" class="nav-tab" id="tab1-link">Web</a>
20 - <a href="#tab2" class="nav-tab" id="tab2-link">Web Push</a>
21 - </h2>
409 +<!-- errors/success message -->
22 410
23 -<?php
24 - if($_SERVER['REQUEST_METHOD'] == 'POST' && count($taboola_errors) == 0 && $taboola_save_error == ''){
411 + <?php
412 + if($_SERVER['REQUEST_METHOD'] == 'POST' && count($taboola_errors) == 0){
25 413 echo "<div class='label-success'>";
26 414 echo "<h3 style='color:green;'>Changes applied!</h3>";
27 415 echo "<span>Verify the new changes by browsing to your site.</span>";
28 416 echo "</div>";
29 417 }
30 -
31 - if($taboola_save_error != ''){
32 - echo "<div class='label-error'>";
33 - echo "<h3 style='color:red;'>Settings were not saved</h3>";
34 - echo "<p>".esc_html($taboola_save_error)."</p>";
35 - echo "<p><b>All values</b> have been reverted to the last successful save.</p>";
36 - echo "</div>";
37 - }
38 418
39 419 if(count($taboola_errors) > 0){
40 420 echo "<div class='label-error'>";
41 421 echo "<h3 style='color:red;'>Missing or incorrect values</h3>";
@@ -52,50 +432,33 @@
52 432 ?>
53 433
54 434 <script>
55 435 function setEnabledDisabled(divID, chkToggle) {
436 + /*
437 + JS function for form.
438 + Enables/disables fields for the given section ('divID'), depending on whether 'chkToggle' is checked.
439 + */
440 +
56 441 var applyColor = (chkToggle.checked ? "#000" : "#666");
442 +
443 + // Set all labels in that section ('divID') to the relevant color.
57 444 $(divID).find("label").css("color", applyColor);
445 +
446 + // Disable (/enable) all input fields in that section ('divID'), except for 'chkToggle'.
447 + // Once done, apply a gray border color.
58 448 $(divID).find("input").not("#" + chkToggle.id).prop("disabled", !chkToggle.checked).css("borderColor", "#ccc");
59 449 $(divID).find("select").not("#" + chkToggle.id).prop("disabled", !chkToggle.checked).css("borderColor", "#ccc");
60 - }
61 -</script>
62 450
63 -<script>
64 -jQuery(document).ready(function($) {
65 - function showTab(tabId) {
66 - $('.nav-tab').removeClass('nav-tab-active');
67 - $('.tab-content').removeClass('active').hide();
68 -
69 - $('a[href="' + tabId + '"]').addClass('nav-tab-active');
70 - $(tabId).addClass('active').show();
71 451 }
72 -
73 - $('.nav-tab').click(function(e) {
74 - e.preventDefault();
75 - var tabId = $(this).attr('href');
76 - window.location.hash = tabId;
77 - $('#active_tab').val(tabId);
78 - showTab(tabId);
79 - });
80 -
81 - var hash = window.location.hash;
82 - if (hash) {
83 - showTab(hash);
84 - $('#active_tab').val(hash);
85 - } else {
86 - showTab('#tab1');
87 - }
88 -
89 - $('form').submit(function() {
90 - var activeTab = $('.nav-tab.nav-tab-active').attr('href');
91 - $('#active_tab').val(activeTab);
92 - });
93 -});
94 452 </script>
95 453
96 454 <script>
97 455 $(document).ready(function(){
456 + // On page load:
457 + if ($('#mid_paragraph_ui_mode').val() == 'Other') {
458 + $("#mid_css_selector_div").show();
459 + }
460 +
98 461 if ($('#home_enabled').prop("checked") === true) {
99 462 $("#homepage").show();
100 463 var ad = $('#show-advanced-settings');
101 464 ad.text("<< Hide advanced settings");
@@ -104,8 +467,9 @@
104 467 </script>
105 468
106 469 <script>
107 470 $(document).ready(function(){
471 + // On clicking 'Advanced settings'
108 472 $("#show-advanced-settings").click(function() {
109 473 $("#homepage").slideToggle("fast");
110 474 var ad = $('#show-advanced-settings');
111 475 ad.text() == "Show advanced settings >>" ? ad.text("<< Hide advanced settings") : ad.text("Show advanced settings >>");
@@ -112,10 +476,44 @@
112 476 });
113 477 });
114 478 </script>
115 479
116 -<div class="publisher_welcome_massage">
117 - <h2 class="welcome_heading">Welcome to Taboola WordPress Plugin</h2>
480 +
481 +<script>
482 +$(document).ready(function(){
483 +
484 + // On selecting an item in the dropdown:
485 + $('#mid_paragraph_ui_mode').on('change', function(e){
486 + e.preventDefault();
487 + if ( this.value == 'Other')
488 + {
489 + $("#mid_css_selector_div").show();
490 +
491 + // Highlight relevant fields:
492 + $("#mid_location_string, #mid_occurrence").addClass('highlight');
493 + setTimeout(() => $("#mid_occurrence, #mid_location_string").removeClass('highlight'), 1500);
494 +
495 + }
496 + else
497 + {
498 + $("#mid_location_string").val("p"); // Set it back to the default value of 'p'
499 + $("#mid_css_selector_div").hide();
500 +
501 + // Highlight the 'occurrence' field:
502 + $("#mid_occurrence").addClass('highlight');
503 + setTimeout(() => $("#mid_occurrence").removeClass('highlight'), 1000);
504 + }
505 + });
506 +
507 +});
508 +</script>
509 +
510 +
511 +
512 +<!-- Welcome Massage -->
513 +
514 + <div class="publisher_welcome_massage">
515 + <h2 class="welcome_heading">Welcome to Taboola WordPress Plugin 2!</h2>
118 516 <p class="first_p">For detailed instructions, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements" target='_blank'>Taboola Dev Center.</a></p>
119 517 <p class="second_p"><b>Stuck? Need a hand?</b> Feel free to reach out via our <a href="https://developers.taboola.com/web-integrations/discuss" target='_blank'>Online Community</a>.</p>
120 518 <div class="list_l1">
121 519 <p>Usage of this plugin is subject to <b>Taboola's</b> <a href="https://www.taboola.com/policies/platform-terms-of-service" target='_blank'>terms of service.</a></p>
@@ -121,266 +519,161 @@
121 519 <p>Usage of this plugin is subject to <b>Taboola's</b> <a href="https://www.taboola.com/policies/platform-terms-of-service" target='_blank'>terms of service.</a></p>
122 520 </div>
123 521 </div>
124 522
125 -<form method="POST">
126 -<?php
523 +<!-- Welcome Massage-->
524 +
525 + <form method="POST">
526 +
527 + <?php
528 + // Generate a nonce and pass it via a hidden field
127 529 $my_nonce = wp_create_nonce( 'my_plugin_update_field_action' );
128 -?>
129 -<input type="hidden" name="my_plugin_nonce" value="<?php echo esc_attr( $my_nonce ); ?>"/>
130 -<input type="hidden" id="active_tab" name="active_tab" value="#tab1"/>
530 + ?>
131 531
532 + <input type="hidden" name="my_plugin_nonce" value="<?php echo esc_attr( $my_nonce ); ?>"/>
132 533
133 -<div id="tab1" class="tab-content">
134 - <h2 class="general_h2">General Settings</h2>
135 -
136 - <div class="settings_block">
137 - <div class="style_box1"><label id="pub_id">Publisher ID :</label>
138 - <div class="tooltip">
139 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_first">
140 - <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
141 - </g>
142 - </svg>
143 - <div>Your Publisher ID, as provided by Taboola.</div>
144 - </div>
534 + <h2 class="general_h2">General Settings</h2>
535 +
536 + <div class="settings_block">
537 + <div class="style_box1"><label id="pub_id">Publisher ID :</label>
538 + <div class="tooltip">
539 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
540 + <!-- <img class="helpTooltip__icon___1XWGN" src='<?php echo $this->plugin_url.'img/tooltip_image.svg' ?>'/> -->
541 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_first">
542 + <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
543 + </g>
544 + </svg>
545 + <!-- <div id="arrow" ></div> -->
546 + <div>Your Publisher ID, as provided by Taboola.</div>
145 547 </div>
146 - <div class="pub_id">
147 - <input id="publisher-id" type="text" name="publisher_id" placeholder="publisher" value="<?php echo !empty($settings->publisher_id) ? strip_tags($settings->publisher_id) : '' ?>"/>
148 - </div>
149 - <div class="statement">
150 - <label style="color: #000000; padding-">
151 - Don't have an account with taboola? <a href='http://taboola.com/contact' target='_blank'>Contact us</a> to get started.
152 - </label>
153 - </div>
154 548 </div>
549 + <div class="pub_id">
550 + <input id="publisher-id" type="text" name="publisher_id" placeholder="publisher" value="<?php echo !empty($settings->publisher_id) ? htmlspecialchars($settings->publisher_id) : '' ?>"/>
551 + </div>
552 + <div class="statement">
553 + <label style="color: #000000;">Don't have an account with taboola?</label>
554 + <a style='float: inherit;' class='request_link' href='http://taboola.com/contact' target='_blank'>Contact us</a>
555 + <label style="margin-left: -9px; color: #000000;">to get started.</label>
556 + </div>
557 + </div>
155 558
559 +
560 +<!-- Below Article Widget -->
156 561 <h2 class="widget_h2">Taboola Units</h2>
157 - <div id="below_article" class="settings_block widget_settings_block">
158 - <div class="switch_style">
159 - <label class="switch">
160 - <input id="first_bc_enabled" type="checkbox" <?php echo !empty($settings->first_bc_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#below_article', this)" name="first_bc_enabled" />
161 - <span class="slider round"></span>
162 - </label>
163 - <b style="font-size:15px;">Below-article</b>
562 + <div id="below_article" class="settings_block widget_settings_block">
563 + <div class="switch_style">
564 + <label class="switch">
565 + <input id="first_bc_enabled" type="checkbox" <?php echo !empty($settings->first_bc_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#below_article', this)" name="first_bc_enabled" />
566 + <span class="slider round"></span>
567 + </label>
568 + <b style="font-size:15px;">Below-article</b>
569 + </div>
570 + <div class="label_below">
571 + <div class="mode_style">
572 + <label id="first_bc_widget_id_label" style="float:left;">Mode (Widget ID):</label>
573 + <div class="tooltip">
574 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
575 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
576 + <g fill="none" fill-rule="evenodd">
577 + <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
578 + </g>
579 + </svg>
580 + <div>Your <i>below-article</i> Mode (Widget ID), as provided by Taboola. </div>
581 + </div>
164 582 </div>
165 - <div class="label_below">
166 - <div class="mode_style">
167 - <label id="first_bc_widget_id_label" style="float:left;">Mode (Widget ID):</label>
168 - <div class="tooltip">
169 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
170 - <g fill="none" fill-rule="evenodd">
171 - <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
172 - </g>
173 - </svg>
174 - <div>Your <i>below-article</i> Mode (Widget ID), as provided by Taboola. </div>
175 - </div>
176 - </div>
177 - <div class="placement_style">
178 - <label id="first_bc_placement_label" style="float:left;">Placement Name:</label>
179 - <div class='tooltip'>
180 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
181 - <g fill="none" fill-rule="evenodd">
182 - <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
183 - </g>
184 - </svg>
185 - <div>Your <i>below-article</i> Placement Name, as provided by Taboola. <br>
186 - <br> When upgrading from v1, fill in 'below-article'. <br>
187 - <br> For more information, reach out via our <a href="https://developers.taboola.com/web-integrations/discuss" target='_blank'>Online Community</a>, or contact Taboola Support.
188 - </div>
189 - </div>
190 - </div>
191 - </div>
192 - <div class="input_below">
193 - <div class="widget_below">
194 - <input id="first_bc_widget_id" type="text" value="<?php echo !empty($settings->first_bc_widget_id) ? strip_tags($settings->first_bc_widget_id) : "" ?>" name="first_bc_widget_id" placeholder="Widget ID" />
195 - </div>
196 - <div class="placement_below">
197 - <input type="text" id="first_bc_placement" value="<?php echo !empty($settings->first_bc_placement) ? strip_tags($settings->first_bc_placement) : "" ?>" name="first_bc_placement" placeholder="Placement Name" />
198 - </div>
199 - </div>
200 - <br />
201 - <div class='location_section'>
202 - <div class='checkbox_read'>
203 - <input id="out_of_content_enabled" type="checkbox" <?php echo !empty($settings->out_of_content_enabled) ? "checked='checked'" : "" ?> name="out_of_content_enabled" />
204 - <label id="out_of_content_enabled_label">Place the feed/widget just after the article container (required for <b>Read More</b>)</label>
205 - </div>
206 - <div class='tooltip'>
207 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_read">
208 - <g fill="none" fill-rule="evenodd">
583 + <div class="placement_style">
584 + <label id="first_bc_placement_label" style="float:left;">Placement Name:</label>
585 + <div class='tooltip'>
586 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
587 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
588 + <g fill="none" fill-rule="evenodd">
209 589 <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
210 - </g>
590 + </g>
211 591 </svg>
212 - <div>
213 - Required in order for Taboola to activate <i>Read More</i>.<br><br>
214 - Read More buttons can boost audience engagement significantly, especially on mobile devices.<br><br>
215 - For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements#below-article-widget" target='_blank'>Taboola Dev Center</a>.</div>
592 + <div>Your <i>below-article</i> Placement Name, as provided by Taboola. <br>
593 + <br> When upgrading from v1, fill in 'below-article'. <br>
594 + <br> For more information, reach out via our <a href="https://developers.taboola.com/web-integrations/discuss" target='_blank'>Online Community</a>, or contact Taboola Support.
216 595 </div>
596 + </div>
217 597 </div>
598 + </div>
599 + <div class="input_below">
600 + <div class="widget_below">
601 + <input id="first_bc_widget_id" type="text" value="<?php echo !empty($settings->first_bc_widget_id) ? htmlspecialchars($settings->first_bc_widget_id) : "" ?>" name="first_bc_widget_id" placeholder="Widget ID" />
218 602 </div>
603 + <div class="placement_below">
604 + <input type="text" id="first_bc_placement" value="<?php echo !empty($settings->first_bc_placement) ? htmlspecialchars($settings->first_bc_placement) : "" ?>" name="first_bc_placement" placeholder="Placement Name" />
605 + </div>
606 + </div>
219 607
220 - <div id="mid_article" class="settings_block widget_settings_block">
221 - <div class="switch_style">
222 - <label class="switch">
223 - <input id="mid_enabled" type="checkbox" <?php echo !empty($settings->mid_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#mid_article', this)" name="mid_enabled"/>
224 - <span class="slider round"></span>
225 - </label>
226 - <b style="font-size:15px;">Mid-article</b>
227 - </div>
228 -
229 - <div id="mid-article-widgets-container">
230 - <?php
231 - $mid_widgets = !empty($settings->mid_widgets) ? json_decode($settings->mid_widgets) : array();
232 - if (empty($mid_widgets)) {
233 - $mid_widgets = array(new stdClass());
234 - }
235 - foreach ($mid_widgets as $index => $widget) {
236 - ?>
237 - <div class="mid-article-widget" style="border: 1px solid #ddd; padding: 10px; margin-top: 10px; border-radius: 5px;">
238 - <h4 style="font-size: 14px; font-weight: bold;">Mid-Article Widget #<?php echo $index + 1; ?></h4>
239 - <div style="display: flex; flex-wrap: wrap;">
240 - <div style="flex: 1; min-width: 250px; padding-right: 10px;">
241 - <label>Mode (Widget ID):</label>
242 - <input class="widefat" type="text" name="mid_widget_id[]" value="<?php echo esc_attr($widget->widget_id ?? ''); ?>" placeholder="thumbnails-mid1" />
243 - </div>
244 - <div style="flex: 1; min-width: 250px;">
245 - <label>Placement Name:</label>
246 - <input class="widefat" type="text" name="mid_placement[]" value="<?php echo esc_attr($widget->placement ?? ''); ?>" placeholder="Mid Article Thumbnails" />
247 - </div>
248 - </div>
249 - <div class='heading_mid_home'><label style="float:left;">Position the widget immediately below the element:</label>
608 + <!-- Below Article Widget -->
609 + <!-- Advanced Settings -->
610 + <br />
611 + <div class='location_section'>
612 + <div class='checkbox_read'>
613 + <input id="out_of_content_enabled" type="checkbox" <?php echo !empty($settings->out_of_content_enabled) ? "checked='checked'" : "" ?> name="out_of_content_enabled" />
614 + <label id="out_of_content_enabled_label">Place the feed/widget just after the article container (required for <b>Read More</b>)</label>
615 + </div>
250 616 <div class='tooltip'>
251 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
252 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
253 - <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
254 - </g>
255 - </svg>
256 - <div>The widget will be placed <i>just beneath</i> this element.<br><br>
257 - To target an element, 2 pieces of information are needed:<br><br>
258 - i) A CSS selector - e.g. <i>p</i> (for paragraph).<br>
259 - ii) An occurrence - e.g. 1st, 2nd, 3rd, etc.<br><br>
260 - For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements" target='_blank'>Taboola Dev Center</a>.
261 - </div>
617 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_read">
618 + <g fill="none" fill-rule="evenodd">
619 + <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
620 + </g>
621 + </svg>
622 + <div>
623 + Required in order for Taboola to activate <i>Read More</i>.<br><br>
624 + Read More buttons can boost audience engagement significantly, especially on mobile devices.<br><br>
625 + For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements#below-article-widget" target='_blank'>Taboola Dev Center</a>.</div>
262 626 </div>
627 + </div>
263 628 </div>
629 +<!-- Advanced Settings -->
264 630
265 - <div style="display: flex; flex-wrap: wrap; margin-top: 10px;">
266 - <div style="flex: 1; min-width: 200px; padding-right: 10px;">
267 - <label>Position:</label>
268 - <select class="widefat mid-widget-type-selector" name="mid_paragraph_ui_mode[]">
269 - <option value="Paragraph" <?php echo !isset($widget->location_string) || $widget->location_string === 'p' ? 'selected' : ''; ?>>Paragraph</option>
270 - <option value="Other" <?php echo isset($widget->location_string) && $widget->location_string !== 'p' ? 'selected' : ''; ?>>Other (Custom)</option>
271 - </select>
272 - </div>
273 - <div style="flex: 1; min-width: 150px; padding-right: 10px;" class="mid-css-selector-container">
274 - <label>CSS selector:</label>
275 - <input class="widefat" type="text" name="mid_location_string[]" value="<?php echo esc_attr($widget->location_string ?? 'p'); ?>" />
276 - </div>
277 - <div style="flex: 1; min-width: 150px;">
278 - <label>Paragraph/Element Number:</label>
279 - <input class="widefat" type="number" name="mid_location_string_occurrence[]" value="<?php echo esc_attr($widget->occurrence ?? '1'); ?>" min="1" style="width:80px;">
280 - </div>
281 - </div>
282 - <button type="button" class="button remove-mid-widget" style="margin-top: 10px;">Remove Widget</button>
631 +<!-- Mid Article Widget -->
632 +
633 +<div id="mid_article" class="settings_block widget_settings_block">
634 + <div class="switch_style">
635 + <label class="switch">
636 + <input id="mid_enabled" type="checkbox" <?php echo !empty($settings->mid_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#mid_article', this)" name="mid_enabled"/>
637 + <span class="slider round"></span>
638 + </label>
639 + <b style="font-size:15px;">Mid-article</b>
283 640 </div>
284 - <?php } ?>
285 - </div>
286 - <button type="button" id="add-mid-widget" class="button button-primary" style="margin-top: 15px;">+ Add Another Mid-Article Widget</button>
287 - </div>
288 - <div id="right-rail" class="settings_block widget_settings_block">
289 - <label id="right-rail-label"><b style="font-size:15px;margin-left: 10px;">Right-rail (sidebar)</b> </label>
290 - <div style="font-size:14px;margin: 5px 10px 10px 10px;">You can insert a <b>Taboola</b> unit in your website <b>sidebar</b> (if your <b>WordPress</b> theme provides one):</div>
291 641
292 - <div id="rightrail-banner">
293 - 1. In the <b>sidebar menu</b> (<i>left</i>) select <b>Appearance</b> > <b>Widgets</b>, or click <a href="widgets.php" target="_blank">here</a> to open the <b>Widgets</b> panel. </br>
294 - 2. Click on the <span style="font-size: 18px; font-weight:bold">+</span> icon (<i>top, left</i>) and type in <b>"Taboola".</b></br>
295 - 3. Drag the <b>Taboola</b> widget to the desired position in the sidebar (<i>right</i>).</br>
296 - 4. Enter the <b>Widget ID (Mode)</b>, as provided by <b>Taboola</b>.</br>
297 - 5. Click on <b>Update</b> (<i>top, right</i>) to save your changes.</br>
298 - 6. Browse to your website and verify that the newly added unit displays correctly.</br>
299 - <hr>
300 - To <b>watch a demo</b> of the above steps, see our <a href="https://developers.taboola.com/web-integrations/docs/sidebar-widget" target="_blank">online docs</a>.
301 - </div>
302 - </div>
303 -<div id="category_widget" class="settings_block widget_settings_block">
304 - <div class="switch_style">
305 - <label class="switch">
306 - <input id="category_enabled"
307 - type="checkbox"
308 - <?php echo !empty($settings->category_enabled) ? "checked='checked'" : "" ?>
309 - onclick="setEnabledDisabled('#category_widget', this)"
310 - name="category_enabled"/>
311 - <span class="slider round"></span>
312 - </label>
313 - <b style="font-size:15px;float: left;">Category (Section Page)</b>
642 + <div>
643 + <div class="mode_style_mid"><label id="mid_widget_id_label" style="float:left;">Mode (Widget ID):</label>
314 644 <div class='tooltip'>
315 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
316 - <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
317 - </g>
318 - </svg>
319 - <div>Settings will be applied to all 'Category/Section' pages on your site.</div>
320 - </div>
321 - </div>
322 -
323 - <div class="label_below">
324 -
325 - <div class="mode_style">
326 - <label id="category_widget_id_label" style="float:left;">Mode (Widget ID):</label>
327 - <div class='tooltip'>
328 645 <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
329 646 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
330 647 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
331 - </g>
648 + </g>
332 649 </svg>
333 - <div>Your <i>category</i> Mode (Widget ID), as provided by Taboola.</div>
650 + <div>Your <i>mid-article</i> Mode (Widget ID), as provided by Taboola.</div>
334 651 </div>
335 652 </div>
336 -
337 - <div class="placement_style"><label id="category_placement_label" style="float:left;">Placement Name:</label>
653 + <div class="placement_style_mid"><label id="mid_placement_label" style="float:left;">Placement Name:</label>
338 654 <div class='tooltip'>
339 655 <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
340 656 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
341 657 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
342 - </g>
658 + </g>
343 659 </svg>
344 - <div>Your <i>category</i> Placement Name, as provided by Taboola.</div>
660 + <div>Your <i>mid-article</i> Placement Name, as provided by Taboola.</div>
345 661 </div>
346 662 </div>
347 663 </div>
348 -
349 -
350 - <div class="input_below">
351 - <div class="widget_below">
352 - <input id="category_widget_id" type="text"
353 - value="<?php echo !empty($settings->category_widget_id) ? strip_tags($settings->category_widget_id) : '' ?>"
354 - name="category_widget_id" placeholder="Widget ID"/>
355 - </div>
356 - <div class="placement_below">
357 - <input id="category_placement" type="text"
358 - value="<?php echo !empty($settings->category_placement) ? strip_tags($settings->category_placement) : '' ?>"
359 - name="category_placement" placeholder="Placement Name"/>
360 - </div>
361 - </div>
362 -
363 - <div class='heading_mid_home'><label style="float:left;">Position the widget immediately below the element:</label>
364 - <div class='tooltip'>
365 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
366 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
367 - <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
368 - </g>
369 - </svg>
370 - <div>The widget will be placed <i>just beneath</i> this element.<br><br>
371 - To target an element, 2 pieces of information are needed:<br><br>
372 - i) A CSS selector - e.g. <i>p</i> (for paragraph).<br>
373 - ii) An occurrence - e.g. 1st, 2nd, 3rd, etc.<br><br>
374 - For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements" target='_blank'>Taboola Dev Center</a>.
664 + <div>
665 + <div class="widget_below_mid">
666 + <input id="mid_widget_id" type="text" value="<?php echo !empty($settings->mid_widget_id) ? htmlspecialchars($settings->mid_widget_id) : "" ?>" name="mid_widget_id" placeholder="Widget ID" />
375 667 </div>
668 + <div class="placement_below_mid">
669 + <input id = "mid_placement" type="text" value="<?php echo !empty($settings->mid_placement) ? htmlspecialchars($settings->mid_placement) : "" ?>" name="mid_placement" placeholder="Placement Name" />
670 + </div>
376 671 </div>
377 - </div>
378 672
379 - <div class="home_occurrence">
380 - <div class="mode_style_home_selector">
381 - <label id="category_location_string_label" style="float:left;">CSS selector&nbsp;:</label>
382 - <div class='tooltip'>
673 + <div id="mid_occurrence_div">
674 + <div class="mode_style_mid_selector"><label id="mid_location_string_label" style="float:left;">Position the widget below:</label>
675 + <div class='tooltip'>
383 676 <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
384 677 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
385 678 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
386 679 </g>
@@ -385,46 +678,51 @@
385 678 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
386 679 </g>
387 680 </svg>
388 681 <div>
389 - The element to target - e.g.:<br><br>
390 - <i>section</i> - to target a <i>section</i>.<br>
391 - <i>#my-id</i> - to target an <i>ID</i> of "my-id".<br>
392 - <i>.my-class</i> - to target a <i>class</i> of "my-class".
682 + Enter the paragraph number to target. <br>
683 + E.g. To target the <b>5th</b> paragraph, fill in <i>5</i>.<br><br>
684 + ----<br>
685 + <i>Advanced</i> - to use a <b>custom</b> selector:<br><br>
686 + 1) Choose 'Other'. <br>
687 + 2) Fill in a selector (<i>right</i>), and an occurrence (<i>left</i>).
393 688 </div>
394 689 </div>
395 -
396 - </div>
397 - <div class="placement_style_home_occurrence">
398 - <label id="category_occurrence_label" style="float:left;">Occurrence&nbsp;:</label>
399 - <div class='tooltip'>
400 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
690 + </div>
691 + <div class="placement_below_mid_occurrence">
692 + <select name="mid_paragraph_ui_mode" id="mid_paragraph_ui_mode">
693 + <option value="Paragraph" <?php echo (!empty($settings->mid_paragraph_ui_mode) && $settings->mid_paragraph_ui_mode == "Paragraph") ? "selected" : ""?> >Paragraph</option>
694 + <option value="Other" <?php echo (!empty($settings->mid_paragraph_ui_mode) && $settings->mid_paragraph_ui_mode == "Other") ? "selected" : ""?>>Other</option>
695 + </select>&nbsp;
696 + <input type="number" id="mid_occurrence" value="<?php echo !empty($settings->mid_location_string_occurrence) ? $settings->mid_location_string_occurrence : "1" ?>" name="mid_location_string_occurrence" placeholder="" style="width:65px;">
697 + </div>
698 +
699 + </div>
700 + <div id="mid_css_selector_div">
701 +
702 + <div class="placement_style_mid_occurrence"><label id="mid_occurrence_label" style="float:left;">CSS selector :</label>
703 + <div class='tooltip'>
401 704 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
402 705 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
403 706 </g>
404 707 </svg>
405 - <div>For a <b>non-unique</b> selector - e.g. <i>section</i> - fill in the <b>occurrence</b> to target.<br><br>
406 - E.g. To target the <b>2nd</b> section, fill in <i>2</i>. <br><br>
407 - For a <b>unique</b> selector - e.g. <i>#my-id</i> - leave the default value of '1'.</div>
708 + <div>
709 + <i>Advanced</i> - fill in a selector to target - e.g.:<br><br>
710 + <i>#my-id</i> - to target an <i>ID</i> of "my-id".<br>
711 + <i>.my-class</i> - to target a <i>class</i> of "my-class".
712 + </div>
408 713 </div>
409 -
410 - </div>
714 + </div>
715 + <div class="widget_below_mid_selector">
716 + <input id = "mid_location_string" type="text" value="<?php echo !empty($settings->mid_location_string) ? htmlspecialchars($settings->mid_location_string) : "p" ?>" name="mid_location_string" placeholder="E.g. p for paragraph" />
717 + </div>
718 + </div>
411 719 </div>
720 +<!-- Mid Article Widget -->
412 721
413 - <div class="home_placement">
414 - <div class="widget_below_home_selector">
415 - <input id="category_location_string" type="text"
416 - value="<?php echo !empty($settings->category_location_string) ? strip_tags($settings->category_location_string) : '' ?>"
417 - name="category_location_string" placeholder="e.g. #content"/>
418 - </div>
419 - <div class="placement_below_home_Occurrence">
420 - <input id="category_occurrence" type="number" min="1"
421 - value="<?php echo !empty($settings->category_location_string_occurrence) ? $settings->category_location_string_occurrence : '1' ?>"
422 - name="category_location_string_occurrence"
423 - style="width:65px;">
424 - </div>
425 - </div>
426 -</div>
722 +<!-- Homepage mid widget -->
723 +
724 +
427 725 <div id="homepage" class="settings_block widget_settings_block">
428 726 <div class="switch_style">
429 727 <label class="switch">
430 728 <input id="home_enabled" type="checkbox" <?php echo !empty($settings->home_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#homepage', this)" name="home_enabled"/>
@@ -432,8 +730,9 @@
432 730 </label>
433 731 <div>
434 732 <b style="font-size:15px;float: left;">Homepage (front page)</b>
435 733 <div class='tooltip'>
734 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
436 735 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
437 736 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
438 737 </g>
439 738 </svg>
@@ -444,8 +743,9 @@
444 743
445 744 <div>
446 745 <div class="mode_style_home"><label id="home_widget_id_label" style="float:left;">Mode (Widget ID):</label>
447 746 <div class='tooltip'>
747 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
448 748 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
449 749 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
450 750 </g>
451 751 </svg>
@@ -453,8 +753,9 @@
453 753 </div>
454 754 </div>
455 755 <div class="placement_style_home"><label id="home_placement_label" style="float:left;">Placement Name:</label>
456 756 <div class='tooltip'>
757 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
457 758 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
458 759 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
459 760 </g>
460 761 </svg>
@@ -463,17 +764,18 @@
463 764 </div>
464 765 </div>
465 766 <div>
466 767 <div class="widget_below_home">
467 - <input id="home_widget_id" type="text" value="<?php echo !empty($settings->home_widget_id) ? strip_tags($settings->home_widget_id) : "" ?>" name="home_widget_id" placeholder="Widget ID" />
768 + <input id="home_widget_id" type="text" value="<?php echo !empty($settings->home_widget_id) ? htmlspecialchars($settings->home_widget_id) : "" ?>" name="home_widget_id" placeholder="Widget ID" />
468 769 </div>
469 770 <div class="placement_below_home">
470 - <input id = "home_placement" type="text" value="<?php echo !empty($settings->home_placement) ? strip_tags($settings->home_placement) : "" ?>" name="home_placement" placeholder="Placement Name" />
771 + <input id = "home_placement" type="text" value="<?php echo !empty($settings->home_placement) ? htmlspecialchars($settings->home_placement) : "" ?>" name="home_placement" placeholder="Placement Name" />
471 772 </div>
472 773 </div>
473 774
474 775 <div class='heading_mid_home'><label style="float:left;">Position the widget immediately below the element:</label>
475 776 <div class='tooltip'>
777 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
476 778 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
477 779 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
478 780 </g>
479 781 </svg>
@@ -489,8 +791,9 @@
489 791
490 792 <div class="home_occurrence">
491 793 <div class="mode_style_home_selector"><label id="home_location_string_label" style="float:left;">CSS selector :</label>
492 794 <div class='tooltip'>
795 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
493 796 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
494 797 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
495 798 </g>
496 799 </svg>
@@ -503,8 +806,9 @@
503 806 </div>
504 807 </div>
505 808 <div class="placement_style_home_occurrence"><label id="home_occurrence_label" style="float:left;">Occurrence :</label>
506 809 <div class='tooltip'>
810 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
507 811 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
508 812 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
509 813 </g>
510 814 </svg>
@@ -515,9 +819,9 @@
515 819 </div>
516 820 </div>
517 821 <div class="home_placement">
518 822 <div class="widget_below_home_selector">
519 - <input id = "home_location_string" type="text" value="<?php echo !empty($settings->home_location_string) ? strip_tags($settings->home_location_string) : "" ?>" name="home_location_string" placeholder="E.g. p for paragraph" /></td>
823 + <input id = "home_location_string" type="text" value="<?php echo !empty($settings->home_location_string) ? htmlspecialchars($settings->home_location_string) : "" ?>" name="home_location_string" placeholder="E.g. p for paragraph" /></td>
520 824 </div>
521 825 <div class="placement_below_home_Occurrence">
522 826 <input type="number" id="home_occurrence" value="<?php echo !empty($settings->home_location_string_occurrence) ? $settings->home_location_string_occurrence : "1" ?>" name="home_location_string_occurrence" placeholder="" style="width:65px;">
523 827 </div>
@@ -522,9 +826,8 @@
522 826 <input type="number" id="home_occurrence" value="<?php echo !empty($settings->home_location_string_occurrence) ? $settings->home_location_string_occurrence : "1" ?>" name="home_location_string_occurrence" placeholder="" style="width:65px;">
523 827 </div>
524 828 </div>
525 829 </div>
526 -
527 830 <div id="advanced-settings-main">
528 831 <a id="show-advanced-settings">Show advanced settings >></a>
529 832 <div class="change_button">
530 833 <input class='apply_button' type="submit" value="Apply Changes"/>
@@ -530,48 +833,10 @@
530 833 <input class='apply_button' type="submit" value="Apply Changes"/>
531 834 </div>
532 835 </div>
533 836
534 -</div>
837 +<!-- Homepage mid widget -->
535 838
536 -<div id="tab2" class="tab-content" style="display: none;">
537 -<h2 class="general_h2">General Setting</h2>
538 -<div id="web_push" class="settings_block widget_settings_block">
539 - <div class="style_box1"><label id="pub_id">Web Push Account ID:</label>
540 - <div class="tooltip">
541 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_first">
542 - <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
543 - </g>
544 - </svg>
545 - <div>Your SC web-push numeric account ID, as provided by Taboola.<br>
546 - This integration is only for sponsored web-push <br> <br>
547 - The header script and service worker will only be injected if the publisher already has the taboola widget running on their site.
548 - </div>
549 - </div>
550 - <div class="switch_style_push">
551 - <label class="switch">
552 - <input id="web_push_enabled" type="checkbox" <?php echo !empty($settings->web_push_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#web_push', this)" name="web_push_enabled" />
553 - <span class="slider round"></span>
554 - </label>
555 - </div>
556 - </div>
557 - <div class="web_push_id">
558 - <input type="number" id="publisher_id_push" value="<?php echo !empty($settings->publisher_id_push) ? strip_tags($settings->publisher_id_push) : "" ?>" name="publisher_id_push" placeholder="Publisher ID Web Push" />
559 - </div>
560 - <div class="statement">
561 - <label style="color: #000000; padding-">
562 - Don't have an account with taboola? <a href='http://taboola.com/contact' target='_blank'>Contact us</a> to get started.
563 - </label>
564 - </div>
565 -</div>
566 -
567 - <div id="advanced-settings-main">
568 - <div class="change_button">
569 - <input class='apply_button' type="submit" value="Apply Changes"/>
570 - </div>
571 - </div>
572 -</div>
573 -
574 839 </form>
575 840 <div style='clear:both'></div>
576 841
577 842 <?php
@@ -579,102 +844,33 @@
579 844 $userDetails = wp_get_current_user();
580 845 $detailsString = $userDetails->first_name." ".$userDetails->last_name;
581 846 ?>
582 847 <img src="https://logs-01.loggly.com/inputs/d14862f3-64ad-49ca-b28d-1b5d155414ec.gif?source=wp&type=settings&pub=<?=$logPublisher?>&user=<?=urlencode($detailsString)?>&email=<?=urlencode($userDetails->user_email)?>&url=<?=urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}")?>"/>
848 + <!-- <form name="install_log" style="display:none;" method="post" action="http://logs-01.loggly.com/inputs/d14862f3-64ad-49ca-b28d-1b5d155414ec/tag/http/">
849 + <input name="tim" type="hidden" value="<?=date("H:i:s.000")?>">
850 + <input name="pub" type="hidden" value="<?=$logPublisher?>">
851 + <input name="data" type="hideen" value="WORDPRESS_PLUGIN_INSTALL|<?="//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}|{$detailsString}"?>">
852 + </form> -->
583 853 </div>
584 854
585 855 <script>
856 +
857 + // Set enabled/disabled appearance upon page load
858 + // (Function is defined earlier on the page.)
586 859 setEnabledDisabled('#below_article', document.getElementById("first_bc_enabled"));
587 860 setEnabledDisabled('#mid_article', document.getElementById("mid_enabled"));
588 861 setEnabledDisabled('#homepage', document.getElementById("home_enabled"));
589 - setEnabledDisabled('#web_push', document.getElementById("web_push_enabled"));
590 - setEnabledDisabled('#category_widget',document.getElementById('category_enabled'));
862 +
591 863 </script>
592 864
593 865 <script>
594 -jQuery(document).ready(function($) {
595 - let widgetCounter = $('#mid-article-widgets-container .mid-article-widget').length;
596 866
597 - // Function to set the initial correct view for widgets
598 - function initializeWidgetView() {
599 - $('#mid-article-widgets-container .mid-widget-type-selector').each(function() {
600 - var container = $(this).closest('.mid-article-widget');
601 - var selectorInputContainer = container.find('.mid-css-selector-container');
602 -
603 - if ($(this).val() === 'Paragraph') {
604 - selectorInputContainer.hide();
605 - } else {
606 - selectorInputContainer.show();
607 - }
608 - });
609 - }
867 + // Fadeouts for error/success messages
868 + setTimeout(function(){jQuery('.label-success').fadeOut()}, 5000);
869 + setTimeout(function(){jQuery('.label-error').fadeOut()}, 8000);
610 870
611 - // Call the function on page load to fix the initial view
612 - initializeWidgetView();
871 + // PC
872 + // window.onload = function(){
873 + // document.forms['install_log'].submit()
874 + // }
613 875
614 - // Add a new mid-article widget section
615 - $('#add-mid-widget').on('click', function() {
616 - widgetCounter++;
617 - var widgetHtml = `
618 - <div class="mid-article-widget" style="border: 1px solid #ddd; padding: 10px; margin-top: 10px; border-radius: 5px;">
619 - <h4 style="font-size: 14px; font-weight: bold;">Mid-Article Widget #${widgetCounter}</h4>
620 - <div style="display: flex; flex-wrap: wrap;">
621 - <div style="flex: 1; min-width: 250px; padding-right: 10px;">
622 - <label>Mode (Widget ID):</label>
623 - <input class="widefat" type="text" name="mid_widget_id[]" placeholder="thumbnails-mid1" />
624 - </div>
625 - <div style="flex: 1; min-width: 250px;">
626 - <label>Placement Name:</label>
627 - <input class="widefat" type="text" name="mid_placement[]" placeholder="Mid Article Thumbnails" />
628 - </div>
629 - </div>
630 - <div style="display: flex; flex-wrap: wrap; margin-top: 10px;">
631 - <div style="flex: 1; min-width: 200px; padding-right: 10px;">
632 - <label>Position below:</label>
633 - <select class="widefat mid-widget-type-selector" name="mid_paragraph_ui_mode[]">
634 - <option value="Paragraph" selected>Paragraph</option>
635 - <option value="Other">Other (Custom)</option>
636 - </select>
637 - </div>
638 - <div style="flex: 1; min-width: 150px; padding-right: 10px; display:none;" class="mid-css-selector-container">
639 - <label>CSS selector:</label>
640 - <input class="widefat" type="text" name="mid_location_string[]" value="p" />
641 - </div>
642 - <div style="flex: 1; min-width: 150px;">
643 - <label>Paragraph/Element Number:</label>
644 - <input class="widefat" type="number" name="mid_location_string_occurrence[]" value="1" min="1" style="width:80px;">
645 - </div>
646 - </div>
647 - <button type="button" class="button remove-mid-widget" style="margin-top: 10px;">Remove Widget</button>
648 - </div>`;
649 - $('#mid-article-widgets-container').append(widgetHtml);
650 - });
651 -
652 - // Remove a mid-article widget section
653 - $('#mid-article-widgets-container').on('click', '.remove-mid-widget', function() {
654 - $(this).closest('.mid-article-widget').remove();
655 - $('#mid-article-widgets-container .mid-article-widget').each(function(index) {
656 - $(this).find('h4').text(`Mid-Article Widget #${index + 1}`);
657 - });
658 - widgetCounter = $('#mid-article-widgets-container .mid-article-widget').length;
659 - });
660 -
661 - // Handle the show/hide for the CSS selector field on change
662 - $('#mid-article-widgets-container').on('change', '.mid-widget-type-selector', function() {
663 - var container = $(this).closest('.mid-article-widget');
664 - var selectorInputContainer = container.find('.mid-css-selector-container');
665 - var selectorInput = selectorInputContainer.find('input');
666 -
667 - if ($(this).val() === 'Paragraph') {
668 - selectorInputContainer.hide();
669 - selectorInput.val('p');
670 - } else {
671 - selectorInputContainer.show();
672 - }
673 - });
674 -});
675 -</script>
676 -
677 -<script>
678 - setTimeout(function(){jQuery('.label-success').fadeOut()}, 5000);
679 - setTimeout(function(){jQuery('.label-error').fadeOut()}, 8000);
680 876 </script>