PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.1
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.1
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
← All changes | robots-txt/views/scripts.php +69 -19 2.6.5 → 2.7.1 View file →
@@ -15,8 +15,54 @@
15 15 <script>
16 16 jQuery(document).ready(function($) {
17 17 let allowSave = false;
18 18
19 + // Nonce for fetching a paginated page of backups.
20 + const backupsPageNonce = '<?php echo esc_js(wp_create_nonce('metasync_get_robots_backups')); ?>';
21 +
22 + // Load a page of the Backup History panel and swap it in place. Keeps the
23 + // list, its total count, and pagination consistent with backend storage
24 + // after navigation or deletion. Clamps to a valid page if the requested
25 + // one no longer exists (e.g. the last item on a page was deleted).
26 + function loadBackupsPage(page) {
27 + const $panel = $('#metasync-backups-panel');
28 + if (!$panel.length) {
29 + return;
30 + }
31 + $panel.css('opacity', 0.5);
32 + $.ajax({
33 + url: ajaxurl,
34 + type: 'POST',
35 + data: {
36 + action: 'metasync_get_robots_backups',
37 + nonce: backupsPageNonce,
38 + page: page
39 + },
40 + success: function(response) {
41 + if (response.success && response.data && typeof response.data.html === 'string') {
42 + $panel.replaceWith(response.data.html);
43 + } else {
44 + $panel.css('opacity', 1);
45 + }
46 + },
47 + error: function() {
48 + $panel.css('opacity', 1);
49 + }
50 + });
51 + }
52 +
53 + // Pagination controls (Prev/Next).
54 + $(document).on('click', '.metasync-backup-page', function() {
55 + const $btn = $(this);
56 + if ($btn.prop('disabled')) {
57 + return;
58 + }
59 + const page = parseInt($btn.data('page'), 10);
60 + if (!isNaN(page) && page >= 1) {
61 + loadBackupsPage(page);
62 + }
63 + });
64 +
19 65 // Check for restore success message after page reload
20 66 const restoreMessage = sessionStorage.getItem('metasync_robots_restore_message');
21 67 if (restoreMessage) {
22 68 // Remove the message from sessionStorage
@@ -119,8 +165,9 @@
119 165 url: ajaxurl,
120 166 type: 'POST',
121 167 data: {
122 168 action: 'metasync_validate_robots',
169 + nonce: '<?php echo wp_create_nonce('metasync_nonce'); ?>',
123 170 content: content
124 171 },
125 172 success: function(response) {
126 173 if (response.success && response.data) {
@@ -231,9 +278,10 @@
231 278 $.ajax({
232 279 url: ajaxurl,
233 280 type: 'POST',
234 281 data: {
235 - action: 'metasync_get_default_robots'
282 + action: 'metasync_get_default_robots',
283 + nonce: '<?php echo wp_create_nonce('metasync_nonce'); ?>'
236 284 },
237 285 success: function(response) {
238 286 if (response.success) {
239 287 $('#robots-txt-editor').val(response.data.content);
@@ -251,8 +299,9 @@
251 299 url: ajaxurl,
252 300 type: 'POST',
253 301 data: {
254 302 action: 'metasync_validate_robots',
303 + nonce: '<?php echo wp_create_nonce('metasync_nonce'); ?>',
255 304 content: content
256 305 },
257 306 success: function(response) {
258 307 const $results = $('#validation-results');
@@ -296,9 +345,9 @@
296 345 this.style.height = (this.scrollHeight) + 'px';
297 346 });
298 347
299 348 // Preview backup content
300 - $('.metasync-preview-backup').on('click', function(e) {
349 + $(document).on('click', '.metasync-preview-backup', function(e) {
301 350 e.preventDefault();
302 351 const backupId = $(this).data('backup-id');
303 352
304 353 // Show loading state
@@ -303,9 +352,9 @@
303 352
304 353 // Show loading state
305 354 const $button = $(this);
306 355 const originalText = $button.html();
307 - $button.prop('disabled', true).html('<span class="dashicons dashicons-update dashicons-spin" style="margin-top: 3px;"></span> <?php esc_html_e('Loading...', 'metasync'); ?>');
356 + $button.prop('disabled', true).html('<span class="dashicons dashicons-update dashicons-spin"></span> <?php esc_html_e('Loading...', 'metasync'); ?>');
308 357
309 358 $.ajax({
310 359 url: ajaxurl,
311 360 type: 'POST',
@@ -310,8 +359,9 @@
310 359 url: ajaxurl,
311 360 type: 'POST',
312 361 data: {
313 362 action: 'metasync_preview_robots_backup',
363 + nonce: '<?php echo wp_create_nonce('metasync_nonce'); ?>',
314 364 backup_id: backupId
315 365 },
316 366 success: function(response) {
317 367 if (response.success && response.data) {
@@ -348,9 +398,9 @@
348 398 $('#modal-title').html('<?php esc_html_e('Backup Preview', 'metasync'); ?>');
349 399 $('#modal-body').html(previewContent);
350 400
351 401 // Configure restore button (on the left)
352 - $confirmBtn.html('<span class="dashicons dashicons-backup" style="margin-top: 3px;"></span> <?php esc_html_e('Restore', 'metasync'); ?>')
402 + $confirmBtn.html('<span class="dashicons dashicons-backup"></span> <?php esc_html_e('Restore', 'metasync'); ?>')
353 403 .removeClass('button-primary')
354 404 .addClass('button-restore')
355 405 .data('backup-id', backupId)
356 406 .data('nonce', '<?php echo wp_create_nonce('metasync_restore_robots_backup'); ?>')
@@ -389,9 +439,9 @@
389 439 const nonce = $button.data('nonce');
390 440
391 441 // Show loading state
392 442 const originalHtml = $button.html();
393 - $button.prop('disabled', true).html('<span class="dashicons dashicons-update dashicons-spin" style="margin-top: 3px;"></span> <?php esc_html_e('Restoring...', 'metasync'); ?>');
443 + $button.prop('disabled', true).html('<span class="dashicons dashicons-update dashicons-spin"></span> <?php esc_html_e('Restoring...', 'metasync'); ?>');
394 444
395 445 $.ajax({
396 446 url: ajaxurl,
397 447 type: 'POST',
@@ -437,10 +487,9 @@
437 487
438 488 const $button = $(this);
439 489 const backupId = $button.data('backup-id');
440 490 const nonce = $button.data('nonce');
441 - const $backupItem = $button.closest('.metasync-backup-item');
442 -
491 +
443 492 // Show loading state
444 493 const originalHtml = $button.html();
445 494 $button.prop('disabled', true).html('<span class="dashicons dashicons-update dashicons-spin"></span>');
446 495
@@ -453,24 +502,25 @@
453 502 nonce: nonce
454 503 },
455 504 success: function(response) {
456 505 if (response.success) {
457 - // Fade out and remove the backup item
458 - $backupItem.fadeOut(300, function() {
459 - $(this).remove();
460 -
461 - // Check if there are any backups left
462 - if ($('.metasync-backup-item').length === 0) {
463 - $('.metasync-backups-list').html('<p class="description" style="text-align: center; padding: 20px;"><?php esc_html_e('No backups available yet. Backups are created automatically when you save changes.', 'metasync'); ?></p>');
464 - }
465 - });
466 -
467 - // Show success message (you can add a notification system here)
506 + // Refresh the panel so the count and pagination reflect the
507 + // new backend state. Stay on the current page, but if the
508 + // deleted entry was the last one on it, fall back a page.
509 + const $panel = $('#metasync-backups-panel');
510 + let currentPage = parseInt($panel.data('page'), 10) || 1;
511 + const remainingOnPage = $panel.find('.metasync-backup-item').length - 1;
512 + if (remainingOnPage <= 0 && currentPage > 1) {
513 + currentPage -= 1;
514 + }
515 + loadBackupsPage(currentPage);
516 +
517 + // Show success message
468 518 if (response.data && response.data.message) {
469 519 // Create a temporary success notice
470 520 const $notice = $('<div class="notice notice-success is-dismissible" style="margin: 20px 0;"><p>' + response.data.message + '</p></div>');
471 521 $('.metasync-robots-txt-page').prepend($notice);
472 -
522 +
473 523 // Auto-dismiss after 3 seconds
474 524 setTimeout(function() {
475 525 $notice.fadeOut(300, function() {
476 526 $(this).remove();