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 +64 -18 2.6.8 → 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
@@ -299,9 +345,9 @@
299 345 this.style.height = (this.scrollHeight) + 'px';
300 346 });
301 347
302 348 // Preview backup content
303 - $('.metasync-preview-backup').on('click', function(e) {
349 + $(document).on('click', '.metasync-preview-backup', function(e) {
304 350 e.preventDefault();
305 351 const backupId = $(this).data('backup-id');
306 352
307 353 // Show loading state
@@ -306,9 +352,9 @@
306 352
307 353 // Show loading state
308 354 const $button = $(this);
309 355 const originalText = $button.html();
310 - $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'); ?>');
311 357
312 358 $.ajax({
313 359 url: ajaxurl,
314 360 type: 'POST',
@@ -352,9 +398,9 @@
352 398 $('#modal-title').html('<?php esc_html_e('Backup Preview', 'metasync'); ?>');
353 399 $('#modal-body').html(previewContent);
354 400
355 401 // Configure restore button (on the left)
356 - $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'); ?>')
357 403 .removeClass('button-primary')
358 404 .addClass('button-restore')
359 405 .data('backup-id', backupId)
360 406 .data('nonce', '<?php echo wp_create_nonce('metasync_restore_robots_backup'); ?>')
@@ -393,9 +439,9 @@
393 439 const nonce = $button.data('nonce');
394 440
395 441 // Show loading state
396 442 const originalHtml = $button.html();
397 - $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'); ?>');
398 444
399 445 $.ajax({
400 446 url: ajaxurl,
401 447 type: 'POST',
@@ -441,10 +487,9 @@
441 487
442 488 const $button = $(this);
443 489 const backupId = $button.data('backup-id');
444 490 const nonce = $button.data('nonce');
445 - const $backupItem = $button.closest('.metasync-backup-item');
446 -
491 +
447 492 // Show loading state
448 493 const originalHtml = $button.html();
449 494 $button.prop('disabled', true).html('<span class="dashicons dashicons-update dashicons-spin"></span>');
450 495
@@ -457,24 +502,25 @@
457 502 nonce: nonce
458 503 },
459 504 success: function(response) {
460 505 if (response.success) {
461 - // Fade out and remove the backup item
462 - $backupItem.fadeOut(300, function() {
463 - $(this).remove();
464 -
465 - // Check if there are any backups left
466 - if ($('.metasync-backup-item').length === 0) {
467 - $('.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>');
468 - }
469 - });
470 -
471 - // 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
472 518 if (response.data && response.data.message) {
473 519 // Create a temporary success notice
474 520 const $notice = $('<div class="notice notice-success is-dismissible" style="margin: 20px 0;"><p>' + response.data.message + '</p></div>');
475 521 $('.metasync-robots-txt-page').prepend($notice);
476 -
522 +
477 523 // Auto-dismiss after 3 seconds
478 524 setTimeout(function() {
479 525 $notice.fadeOut(300, function() {
480 526 $(this).remove();